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

--- Comment #7 from Jason Merrill <jason at gcc dot gnu.org> 2011-03-30 
02:27:45 UTC ---
(In reply to comment #6)
> I think error message like followings is better.
> ----
> testcase.cpp:11:1: error: need 'typename' before 'enable_if<true, T>::type'
> because 'enable_if<true, T>' is a dependent scope

You don't need 'typename' there because you have 'struct'.  14.6/5:

"A qualified name used as the name in a mem-initializer-id, a base-specifier,
or an elaborated-type-specifier is implicitly assumed to name a type, without
the use of the typename keyword."

But 'int' is not a struct, so substituting 'int' into struct
enable_if<true,T>::type fails.  So a better error message would be

testcase.cpp:12:8: note: template<class T> class enable_if<true, T>::type f(T)
testcase.cpp:12:8: note:    'class enable_if<true,int>::type' resolves to
'int', which is not a class type

currently we don't attempt to explain SFINAE when printing candidates, but that
would be a useful thing to do.

Reply via email to