diff options
author | keinflue <keinflue@posteo.de> | 2025-08-23 11:43:58 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-08-23 11:43:58 +0200 |
commit | 16b044e9789d6b9dc9ec6ed7e5b98731e60e3fcd (patch) | |
tree | d413a3a89de53a9954393910051c934aed511744 /clang/lib/Parse/ParseDecl.cpp | |
parent | 230b9b2026116766d6fdedb499cc8a1e78b647e5 (diff) | |
download | llvm-16b044e9789d6b9dc9ec6ed7e5b98731e60e3fcd.zip llvm-16b044e9789d6b9dc9ec6ed7e5b98731e60e3fcd.tar.gz llvm-16b044e9789d6b9dc9ec6ed7e5b98731e60e3fcd.tar.bz2 |
[clang] Diagnose misplaced array bounds with non-identifier declarators. (#155064)
ParseMisplacedBracketDeclarator assumed that declarators without
associated identifier are ill-formed and already diagnosed previously.
This didn't consider declarators using template-ids, constructors,
destructors, conversion functions, etc.
Fixes #147333.
Diffstat (limited to 'clang/lib/Parse/ParseDecl.cpp')
-rw-r--r-- | clang/lib/Parse/ParseDecl.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp index 65504ff..10355bb 100644 --- a/clang/lib/Parse/ParseDecl.cpp +++ b/clang/lib/Parse/ParseDecl.cpp @@ -7878,9 +7878,9 @@ void Parser::ParseMisplacedBracketDeclarator(Declarator &D) { D.AddTypeInfo(Chunk, TempDeclarator.getAttributePool(), SourceLocation()); } - // The missing identifier would have been diagnosed in ParseDirectDeclarator. + // The missing name would have been diagnosed in ParseDirectDeclarator. // If parentheses are required, always suggest them. - if (!D.getIdentifier() && !NeedParens) + if (!D.hasName() && !NeedParens) return; SourceLocation EndBracketLoc = TempDeclarator.getEndLoc(); |