Date: Thu, 18 Jul 2019 18:49:53 +0300
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
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
Received on 2019-07-18 10:51:51