This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/47125] [4.5/4.6 Regression] ICE occurs in combination with partial specialization and invalid template function.
- From: "jason at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 30 Mar 2011 02:27:47 +0000
- Subject: [Bug c++/47125] [4.5/4.6 Regression] ICE occurs in combination with partial specialization and invalid template function.
- Auto-submitted: auto-generated
- References: <bug-47125-4@http.gcc.gnu.org/bugzilla/>
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.