Specializing inner template struct after outer template instantiation

Hi all,

While porting some code which compiles under gcc (up to 4.9) and MSVC (2012, 2013) I’ve came across this code snippet that is refused by clang and it’s not obvious to me that it is a genuine error. I’m asking here before creating a bug report.

Code in gcc.godbolt.org: http://goo.gl/5mNiY6
--------------8<--------------8<--------------8<--------------8<--------------

#define BEFORE // No error if this line is commented
#define AFTER

template
struct Ptr
{
template<typename U, typename V> struct _Auto;
};

#ifdef BEFORE
Ptr asd;
#endif

template
template
struct Ptr::_Auto<void,V>
{
static const int params[];
};
const void* q = &Ptr::_Auto<void,void>::params;
// Error on this line:

// error: no member named ‘params’ in ‘Ptr::_Auto’

#ifdef AFTER
Ptr asd;
#endif

--------------8<--------------8<--------------8<--------------8<--------------

Thanks!

See http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#1755

This is a known area of difference between compilers; Clang is behaving as specified by the standard, but the standard is likely to be changed to specify different rules in the near future…

Hi Richard,

Thanks for the answer !