mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-16 19:56:38 +00:00
[Clang] prevent setting default lexical access specifier for missing primary declarations (#112424)
This PR resolves a crash triggered by a forward reference to an enum type in a function parameter list. The fix includes setting `Invalid` when `TagUseKind` is `Declaration` to ensure correct error handling. Fixes #112208
This commit is contained in:
parent
8e3772744d
commit
df9769e14b
@ -589,6 +589,7 @@ Bug Fixes to C++ Support
|
||||
- Fixed an assertion failure in range calculations for conditional throw expressions. (#GH111854)
|
||||
- Clang now correctly ignores previous partial specializations of member templates explicitly specialized for
|
||||
an implicitly instantiated class template specialization. (#GH51051)
|
||||
- Fixed an assertion failure caused by invalid enum forward declarations. (#GH112208)
|
||||
|
||||
Bug Fixes to AST Handling
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -17955,6 +17955,8 @@ CreateNewDecl:
|
||||
<< Name;
|
||||
Invalid = true;
|
||||
}
|
||||
if (TUK == TagUseKind::Declaration)
|
||||
Invalid = true;
|
||||
} else if (!PrevDecl) {
|
||||
Diag(Loc, diag::warn_decl_in_param_list) << Context.getTagDeclType(New);
|
||||
}
|
||||
|
@ -143,3 +143,11 @@ struct PR28903 {
|
||||
})
|
||||
};
|
||||
};
|
||||
|
||||
namespace GH112208 {
|
||||
class C {
|
||||
enum E { e = 0 };
|
||||
void f(int, enum E;); // expected-error {{ISO C++ forbids forward references to 'enum' types}} \
|
||||
// expected-error {{unexpected ';' before ')'}}
|
||||
};
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user