[Bug c++/11859] New: Substitution failure incorrectly reported as error in SFINAE situation.
gccbugs at contacts dot eelis dot net
gcc-bugzilla@gcc.gnu.org
Fri Aug 8 22:53:00 GMT 2003
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11859
Summary: Substitution failure incorrectly reported as error in
SFINAE situation.
Product: gcc
Version: 3.4
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: gccbugs at contacts dot eelis dot net
CC: gcc-bugs at gcc dot gnu dot org
GCC rejects the following legal code:
template <int> struct ItT {};
template <typename T> typename T::x f ();
template <typename T> void g (ItT<sizeof(f<T>(0))> *);
template <typename> void g (...);
void h () { g<int>(0); }
During the consideration of the first g() for the call in h(), the failure to
resolve T::x should not be considered an error and the second g() should be
chosen. GCC however reports:
t.cpp:5: error: no matching function for call to `f(int)'
Comeau (4.3.3 beta) compiles the code without problems.
I'm using GCC version 3.4 20030723.
Note: I'm not 100% sure GCC is wrong here, this is quite complex since this
involves a template function lookup during another template function lookup, and
Comeau might be wrong after all.
More information about the Gcc-bugs
mailing list