aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend/CompilerInvocation.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard@metafoo.co.uk>2020-05-10 13:14:51 -0700
committerRichard Smith <richard@metafoo.co.uk>2020-05-10 13:21:04 -0700
commitd6425e2c14370ecb5e2a4be4cfdef65f8ae69bd0 (patch)
tree2073990cf8bd49108cf29a86cbc314d7fcda3cc0 /clang/lib/Frontend/CompilerInvocation.cpp
parent13a633b438b6500ecad9e4f936ebadf3411d0f44 (diff)
downloadllvm-d6425e2c14370ecb5e2a4be4cfdef65f8ae69bd0.zip
llvm-d6425e2c14370ecb5e2a4be4cfdef65f8ae69bd0.tar.gz
llvm-d6425e2c14370ecb5e2a4be4cfdef65f8ae69bd0.tar.bz2
Properly implement 'enum class' parsing.
The 'class' or 'struct' keyword is only permitted as part of either an enum definition or a standalone opaque-enum-declaration, not as part of an elaborated type specifier. We previously failed to diagnose this, and generally didn't properly implement the restrictions on elaborated type specifiers for enumeration types. In passing, also fixed incorrect parsing for enum-bases, which we previously parsed as a type-name, but are actually a type-specifier-seq. This matters for cases like 'enum E : int *p;', which is valid as a Microsoft extension. Plus some minor parse diagnostic improvements. Bumped the recently-added ExtWarn for 'enum E : int x;' to be DefaultError; this is not an intentional extension, so producing an error by default seems appropriate, but the warning flag to disable it may still be useful for code written against old Clang. The same treatment is given here to the diagnostic for 'enum class E x;', which we similarly have incorrectly accepted for many years. These diagnostics continue to be suppressed under -fms-extensions and when compiling Objective-C code. We will need to decide separately whether Objective-C should follow the C++ rules or the (older) MSVC rules.
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
0 files changed, 0 insertions, 0 deletions