[llvm-bugs] [Bug 42845] New: Clang 8 allows C++11-style enums in C

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Jul 31 08:43:49 PDT 2019


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

            Bug ID: 42845
           Summary: Clang 8 allows C++11-style enums in C
           Product: clang
           Version: 8.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C
          Assignee: unassignedclangbugs at nondot.org
          Reporter: mark.l.barbone at gmail.com
                CC: blitzrakete at gmail.com, dgregor at apple.com,
                    erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
                    richard-llvm at metafoo.co.uk

I wrote the following test code:


```
#include <stdint.h>

enum MyEnum : uint8_t {
    A = 3,
    B = 10,
    C = 17,
};
```

This uses C++11 features, but Clang 8 compiles it fine as C code.

Both GCC and Clang 7 reject it with a parse error.

Here is a Compiler Explorer link: https://godbolt.org/z/99K4ck

-- 
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/20190731/77eb2ef9/attachment-0001.html>


More information about the llvm-bugs mailing list