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

Maxime van Noppen maxime.van.noppen at gmail.com
Fri Aug 29 01:38:57 PDT 2014


Hi Richard,

Thanks for the answer !


On Fri, Aug 29, 2014 at 12:24 AM, Richard Smith <richard at metafoo.co.uk>
wrote:

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


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


More information about the cfe-dev mailing list