https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103084

--- Comment #8 from Aaron Ballman <aaron at aaronballman dot com> ---
(In reply to M Welinder from comment #6)
> elaborated-enum-specifier can be a elaborated-type-specifier.  It is in the
> "enum Hog H;" case.
> 
> But elaborated-enum-specifier is NOT an elaborated-type-specifier in the
> "using enum Hog;" case,
> 
> See http://eel.is/c++draft/enum.udecl -- this uses elaborated-enum-specifier
> directly.

You're correct about the productions, but http://eel.is/c++draft/dcl.type.elab
then provides no semantics whatsoever for what type is referred to by an
elaborated-enum-specifier. https://eel.is/c++draft/dcl.type.elab#6 would not
apply, so the only requirement on the type then comes from
http://eel.is/c++draft/enum.udecl#1, which says that the type referred to must
be a reachable enum-specifier. But the type named isn't a reachable
enum-specifier (maybe, who knows, no semantics means we can't really say), it's
a type alias to an enum-specifier. So there's confusion either way you read it,
IMO.

(In reply to M Welinder from comment #7)
> Maybe kick it up to the C++ people?
>
> Note, that if the code is not allowed then a type alias is no longer as
> powerful as the original type.  I really doubt that was intended.

FWIW, my initial inclination was that Clang and ICC were wrong to reject
because this does seem like a useful construct that should be supported. It is
possible there's a Core issue here and that this should not be rejected. The
original paper on the topic doesn't say anything, and I didn't see a mention of
type aliases in the WG21 wiki discussions for the paper, but it's entirely
possible I missed something while looking. So I agree that it'd be useful to
allow this, but I'm not convinced the standard permits it currently.

Reply via email to