aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Parse/ParseDecl.cpp
diff options
context:
space:
mode:
authorAaron Ballman <aaron@aaronballman.com>2022-05-05 13:53:03 -0400
committerAaron Ballman <aaron@aaronballman.com>2022-05-05 14:00:01 -0400
commit967137ca3cb7cf38b2fedf0415946ff3ffd0ef50 (patch)
treec97153623065b7449b607a83730f4451cf7895c9 /clang/lib/Parse/ParseDecl.cpp
parent7e71a039667bad3686771e1b69de24ee836b80b1 (diff)
downloadllvm-967137ca3cb7cf38b2fedf0415946ff3ffd0ef50.zip
llvm-967137ca3cb7cf38b2fedf0415946ff3ffd0ef50.tar.gz
llvm-967137ca3cb7cf38b2fedf0415946ff3ffd0ef50.tar.bz2
No longer accept scoped enumerations in C
We had a think-o that would allow a user to declare a scoped enumeration in C language modes "as a C++11 extension". This is a think-o because there's no way for the user to spell the name of the enumerators; C does not have '::' for a fully-qualified name. See commit d0d87b597259a2b74ae5c2825a081c7e336cb1d0 for details on why this is unintentional for C. Fixes #42372
Diffstat (limited to 'clang/lib/Parse/ParseDecl.cpp')
-rw-r--r--clang/lib/Parse/ParseDecl.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp
index 3d18ffe..8d6e84b 100644
--- a/clang/lib/Parse/ParseDecl.cpp
+++ b/clang/lib/Parse/ParseDecl.cpp
@@ -4531,7 +4531,7 @@ void Parser::ParseEnumSpecifier(SourceLocation StartLoc, DeclSpec &DS,
bool IsScopedUsingClassTag = false;
// In C++11, recognize 'enum class' and 'enum struct'.
- if (Tok.isOneOf(tok::kw_class, tok::kw_struct)) {
+ if (Tok.isOneOf(tok::kw_class, tok::kw_struct) && getLangOpts().CPlusPlus) {
Diag(Tok, getLangOpts().CPlusPlus11 ? diag::warn_cxx98_compat_scoped_enum
: diag::ext_scoped_enum);
IsScopedUsingClassTag = Tok.is(tok::kw_class);