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

Richard Smith richard at metafoo.co.uk
Thu Aug 28 17:24:44 PDT 2014


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...


On Wed, Aug 27, 2014 at 2:59 AM, Maxime van Noppen <
maxime.van.noppen at gmail.com> wrote:

> 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
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140828/e4dc7f7d/attachment.html>


More information about the cfe-dev mailing list