In the current C++ working draft, the name of an enum becomes "visible" immediately after it ([basic.scope.pdecl] p3):
The locus of an enum-specifier or opaque-enum-declaration is immediately after the identifier (if any) in it ([dcl.enum]).
It seems that the rule has been essentially unchanged since C++11 (WG21-N3337).
However, I haven't found any compiler accepting the following usage. All of gcc, clang, msvc, and icc rejects it, saying foo
is not declared or defined.
template<class> using mapped_to_int = int;
enum foo : mapped_to_int<foo> {};
Is there any rule rejecting such usage in the Standard?
Aucun commentaire:
Enregistrer un commentaire