This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/50828] class template parameter not printed for member function template in candidate list
- From: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 22 Oct 2011 13:29:19 +0000
- Subject: [Bug c++/50828] class template parameter not printed for member function template in candidate list
- Auto-submitted: auto-generated
- References: <bug-50828-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50828
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-10-22 13:29:19 UTC ---
I noticed this while analysing PR 42356, the missing template argument makes it
much harder to see why name lookup results are ambiguous
template<typename T>
struct A {
template<typename U>
void f() { }
};
struct B : A<int>, A<void> { };
int main() {
B a;
a.f();
}
f.C: In function âint main()â:
f.C:11:5: error: request for member âfâ is ambiguous
f.C:4:12: error: candidates are: template<class U> void A::f() [with U = U, T =
void]
f.C:4:12: error: template<class U> void A::f() [with U = U, T =
int]
Because T isn't shown in the signature it's not immediately obvious that name
lookup found A<void>::f and A<int>::f in different base classes.