C++ Logo

STD-DISCUSSION

Advanced search

Subject: Fwd: Re[2]: Explicit Specialization
From: Vladimir Grigoriev (vlad.moscow_at_[hidden])
Date: 2019-07-18 12:04:22


Thanks. Yes I mean the draft.

Bur I do not understand why the specialization for A<char> is ill format for the unscoped enumeration.

With best regards,
(Vlad from Moscow)

You can meet me at http://cpp.forum24.ru/ or www.stackoverflow.com or http://ru.stackoverflow.com

>Четверг, 18 июля 2019, 18:55 +03:00 от Brian Bi < bbi5291_at_[hidden] >:
>
>By "C++20" I assume you mean the working draft?
>
>It seems your copy-paste somehow omitted some template arguments. See the correct version below, and also here
>
>template<class T> struct A {
>  enum E : T;
>  enum class S : T;
>};
>template<> enum A<int>::E : int { eint };           // OK
>template<> enum class A<int>::S : int { sint };     // OK
>template<class T> enum A<T>::E : T { eT };
>template<class T> enum class A<T>::S : T { sT };
>template<> enum A<char>::E : char { echar };        // ill-formed, A<char>::E was instantiated
>                                                    // when A<char> was instantiated
>template<> enum class A<char>::S : char { schar };  
>
>On Thu, Jul 18, 2019 at 10:49 AM Vladimir Grigoriev via Std-Discussion < std-discussion_at_[hidden] > wrote:
>>In the p.#7 of the section 13.8.3 Explicit specialization of the C++ 20  there is the following example
>>
>>template <class T> struct A {
>>   enum E : T;
>>   enum class S : T;
>>};
>>
>>template<> enum A::E : int { eint }; // OK
>>template<> enum class A::S : int { sint }; // OK
>>template<class T> enum A<T>::E : T { eT };
>>template<class T> enum class A<T>::S : T { sT };
>>template<> enum A::E : char { echar }; // ill-formed, A::E was instantiated // when A was instantiated
>>template<> enum class A::S : char { schar }; // OK
>>
>>It is unclear why 
>>
>>template<> enum A::E : char { echar };
>>
>>was already instantiated.
>>
>>Is it because 
>>
>>template<> enum A::E : int { eint }; // OK 
>>
>>was already instantiated?
>>
>>With best regards
>>(Vlad from Moscow)
>>
>>You can meet me at http://cpp.forum24.ru/ or www.stackoverflow.com or http://ru.stackoverflow.com --
>>Std-Discussion mailing list
>>Std-Discussion_at_[hidden]
>>http://lists.isocpp.org/mailman/listinfo.cgi/std-discussion
>
>
>--
>Brian Bi

----------------------------------------------------------------------



STD-DISCUSSION list run by herb.sutter at gmail.com

Older Archives on Google Groups