[Bug c++/58590] New: [C++11] Hidden typename not ill-formed under SFINAE conditions
daniel.kruegler at googlemail dot com
gcc-bugzilla@gcc.gnu.org
Tue Oct 1 20:08:00 GMT 2013
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58590
Bug ID: 58590
Summary: [C++11] Hidden typename not ill-formed under SFINAE
conditions
Product: gcc
Version: 4.9.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: daniel.kruegler at googlemail dot com
gcc 4.9.0 20130922 (experimental) compiled with the flags
-std=c++11 -Wall -pedantic-errors
rejects the following code:
//---------------------
struct S { int member; struct member{}; };
template<class T, class = typename T::member>
auto f(int) -> char(&)[1];
template<class T>
auto f(...) -> char(&)[2];
static_assert(sizeof(f<S>(0)) == 2, "");
int main() {
}
//---------------------
"main.cpp|9|error: static assertion failed: |"
After discussion with Richard Smith:
The presence of 'typename' before 'T::member' does not influence name lookup,
and 'S::member' as a template-argument names the non-static data member, not
the type, by [basic.scope.hiding]p2. The relevant rule in [temp.res]p4.
It seems that GCC uses the elaborated-type-specifier lookup instead here.
More information about the Gcc-bugs
mailing list