[llvm-bugs] [Bug 49413] elaborated-enum-base incompatible with NS_ENUM

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Mar 3 13:11:40 PST 2021


https://bugs.llvm.org/show_bug.cgi?id=49413

Richard Smith <richard-llvm at metafoo.co.uk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|INVALID                     |---
                 CC|                            |aaron at aaronballman.com

--- Comment #3 from Richard Smith <richard-llvm at metafoo.co.uk> ---
The error is not produced in -x objective-c nor in -x objective-c++.

The 'enum name : underlying' syntax is not valid at all in C. As a Clang
extension, we permit the C++ language feature in C as well, so the error is
produced in -x c++ and in -x c. Apparently we produce no diagnostic for that
extension by default (for cases that are valid in C++), but all uses of 'enum E
: underlying' are rejected in -x c under -pedantic-errors at least.

Perhaps it would be better if, under -x c, we produced the warning for 'enum
name : underlying' being a Clang extension by default, instead of silently
accepting the invalid code. If we do, then producing a second extension
diagnostic for nesting such an enum in a typedef seems unnecessary and we could
turn that off for C compilations (effectively meaning that the C extension
picks up the Objective-C feature, not the similar-but-more-constraining C++
feature).

Aaron, as our champion of C conformance, what do you think? Silently accepting
this C++ feature in C by default seems at least questionable to me.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210303/c9ee9399/attachment.html>


More information about the llvm-bugs mailing list