[Bug c++/27689] [4.1/4.2 regression] function template incorrectly selected as candidate

gcc-bugzilla at contacts dot eelis dot net gcc-bugzilla@gcc.gnu.org
Sat May 20 21:32:00 GMT 2006



------- Comment #2 from gcc-bugzilla at contacts dot eelis dot net  2006-05-20 21:32 -------
But for what F and T would F<T> match foo<int>::bar ?

In looking for workarounds I found that the same problem occurs when using
partial specialization:

  template <typename> struct S {};
  template <template <typename> class T> struct S<T<int> >;
  template <typename> struct foo { struct bar {}; };
  S<foo<int>::bar> s; // error: S is incomplete

Again, Comeau accepts the code.

Finally, to show that at least *something* is wrong, consider:

  template <typename> struct S { enum { x }; };
  template <template <typename> class T> struct S<T<int> > { enum { x }; };
  template <typename> struct foo { struct bar {}; };
  int i = S<foo<int>::bar>::x; // error: x is not a member of S<foo<int>::bar>

Surely at least one of the two S versions should be selected, and both expose
x. (Again, Comeau accepts the code.)


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27689



More information about the Gcc-bugs mailing list