[cfe-dev] Specializing inner template struct after outer template instantiation

Maxime van Noppen maxime.van.noppen at gmail.com
Wed Aug 27 02:59:44 PDT 2014


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<typename T>
struct Ptr
{
  template<typename U, typename V> struct _Auto;
};

#ifdef BEFORE
Ptr<int> asd;
#endif

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

// error: no member named 'params' in 'Ptr::_Auto'

#ifdef AFTER
Ptr<int> asd;
#endif
--------------8<--------------8<--------------8<--------------8<--------------


Thanks!

-- 
Maxime
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140827/8647f3af/attachment.html>


More information about the cfe-dev mailing list