C++ Logo

STD-DISCUSSION

Advanced search

Subject: Explicit Specialization
From: Vladimir Grigoriev (vlad.moscow_at_[hidden])
Date: 2019-07-18 10:49:53


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 list run by herb.sutter at gmail.com

Older Archives on Google Groups