g++ doesn't seem able to match a template ctor of a template class
where the ctor input is an internal class defined inside any template
class.

I briefly skimmed the titles of the current regression issues and I
didn't notice any that matched this, but I'm not 100% sure.

I first posted this here thinking it was my code that was somehow wrong.
http://www.gamedev.net/community/forums/topic.asp?topic_id=526736

demo.cpp
========================
template <typename T>
class CFoo
  {
    public:
      class CZep {};

      CFoo(int); // line 7.
      template <typename Z> CFoo(typename CFoo<Z>::CZep); // ## ctor I want ##
      ~CFoo();

      CZep zep();
  };


int main()
  {
    CFoo<int> x(1);
    CFoo<int>::CZep z;
    CFoo<int> w(z); // line 19: ## should call the ctor on line 8 ##

    return 0;
  }

========================

g++ demo.cpp
========================
demo.cpp: In function ‘int main()’:
demo.cpp:19: error: no matching function for call to
‘CFoo<int>::CFoo(CFoo<int>::CZep&)’
demo.cpp:7: note: candidates are: CFoo<T>::CFoo(int) [with T = int]
demo.cpp:3: note:                 CFoo<int>::CFoo(const CFoo<int>&)
========================

Specs:
g++ [4.4.0]
ubuntu [ibex, 64]


This compiles fine on 3.3.2 and MSVC according to other testers at gamedev.net.


Note: In the above example CZep is inside CFoo, but it doesn't matter
if you put CZep inside class CBar<T> {} instead, just as long as it's
inside another template class.



Does the above code compile OK on other people's 4.4.0s? or is it a bug?

Reply via email to