public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "aaron at aaronballman dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/103084] Accepts invalid using enum declaration with an invalid elaborated-type-specifier Date: Thu, 04 Nov 2021 19:07:58 +0000 [thread overview] Message-ID: <bug-103084-4-utj9pW6M2B@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-103084-4@http.gcc.gnu.org/bugzilla/> 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.
next prev parent reply other threads:[~2021-11-04 19:07 UTC|newest] Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-11-04 17:06 [Bug c++/103084] New: " aaron at aaronballman dot com 2021-11-04 17:11 ` [Bug c++/103084] " mpolacek at gcc dot gnu.org 2021-11-04 17:50 ` mpolacek at gcc dot gnu.org 2021-11-04 18:06 ` terra at gnome dot org 2021-11-04 18:33 ` mpolacek at gcc dot gnu.org 2021-11-04 18:38 ` aaron at aaronballman dot com 2021-11-04 18:45 ` terra at gnome dot org 2021-11-04 18:54 ` terra at gnome dot org 2021-11-04 19:07 ` aaron at aaronballman dot com [this message] 2021-11-05 14:44 ` terra at gnome dot org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-103084-4-utj9pW6M2B@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).