Skip to content

Commit 45b0532

Browse files
committed
[clang][Parser] Fix crash on invalid attribute in constexpr function
1 parent 29fcad0 commit 45b0532

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

clang/lib/Parse/ParseDeclCXX.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -760,6 +760,10 @@ Parser::DeclGroupPtrTy Parser::ParseUsingDeclaration(
760760

761761
Decl *AD = ParseAliasDeclarationAfterDeclarator(
762762
TemplateInfo, UsingLoc, D, DeclEnd, AS, Attrs, &DeclFromDeclSpec);
763+
764+
if (!AD)
765+
return nullptr;
766+
763767
return Actions.ConvertDeclToDeclGroup(AD, DeclFromDeclSpec);
764768
}
765769

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// RUN: %clang_cc1 -fsyntax-only -verify %s
2+
3+
// issue144264
4+
constexpr void test()
5+
{
6+
using TT = struct T[deprecated{};
7+
// expected-error@-1 {{use of undeclared identifier 'deprecated'}}
8+
}

0 commit comments

Comments
 (0)