<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/144264>144264</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Clang frontend crashes on invalid usage of `[[deprecated]]` inside `constexpr` function
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
Rush10233
</td>
</tr>
</table>
<pre>
Generated by fuzzer that randomly inserts `[[deprecated]]` specifier before function and struct declarations.
Probably starts from clang-6: https://godbolt.org/z/c34Y65Tjn.
Simplified test:
```c++
constexpr void Test6()
{
using TT = struct [[deprecated]] T[deprecated{};
}
```
Stack Dump:
```
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0. Program arguments: /opt/compiler-explorer/clang-trunk/bin/clang++ -gdwarf-4 -g -o /app/output.s -mllvm --x86-asm-syntax=intel -fno-verbose-asm -S --gcc-toolchain=/opt/compiler-explorer/gcc-snapshot -fcolor-diagnostics -fno-crash-diagnostics <source>
1. <eof> parser at end of file
2. <source>:2:1: parsing function body 'Test6'
#0 0x0000000003c31b88 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3c31b88)
#1 0x0000000003c2fccc llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3c2fccc)
#2 0x0000000003b80358 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
#3 0x00007ca24c642520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#4 0x00000000066354f4 CheckConstexprFunctionStmt(clang::Sema&, clang::FunctionDecl const*, clang::Stmt*, llvm::SmallVectorImpl<clang::SourceLocation>&, clang::SourceLocation&, clang::SourceLocation&, clang::SourceLocation&, clang::Sema::CheckConstexprKind) SemaDeclCXX.cpp:0:0
#5 0x0000000006636422 clang::Sema::CheckConstexprFunctionDefinition(clang::FunctionDecl const*, clang::Sema::CheckConstexprKind) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x6636422)
#6 0x00000000065c4598 clang::Sema::ActOnFinishFunctionBody(clang::Decl*, clang::Stmt*, bool) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x65c4598)
#7 0x000000000630dcbf clang::Parser::ParseFunctionStatementBody(clang::Decl*, clang::Parser::ParseScope&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x630dcbf)
#8 0x00000000061e7c06 clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x61e7c06)
#9 0x000000000623424f clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, clang::DeclaratorContext, clang::ParsedAttributes&, clang::Parser::ParsedTemplateInfo&, clang::SourceLocation*, clang::Parser::ForRangeInit*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x623424f)
#10 0x00000000061dffa7 clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec&, clang::AccessSpecifier) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x61dffa7)
#11 0x00000000061e0dbe clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*, clang::AccessSpecifier) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x61e0dbe)
#12 0x00000000061ea92f clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x61ea92f)
#13 0x00000000061ec188 clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x61ec188)
#14 0x00000000061ec6d0 clang::Parser::ParseFirstTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x61ec6d0)
#15 0x00000000061da563 clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x61da563)
#16 0x000000000457ae7d clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-trunk/bin/clang+++0x457ae7d)
#17 0x000000000488ca8a clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-trunk/bin/clang+++0x488ca8a)
#18 0x00000000048082db clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x48082db)
#19 0x0000000004981033 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x4981033)
#20 0x0000000000d95745 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0xd95745)
#21 0x0000000000d8d58d ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#22 0x00000000045ec9b9 void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const::'lambda'()>(long) Job.cpp:0:0
#23 0x0000000003b80773 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3b80773)
#24 0x00000000045ecbd9 clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const (.part.0) Job.cpp:0:0
#25 0x00000000045af77d clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-trunk/bin/clang+++0x45af77d)
#26 0x00000000045b0741 clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/opt/compiler-explorer/clang-trunk/bin/clang+++0x45b0741)
#27 0x00000000045bb06c clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x45bb06c)
#28 0x0000000000d91ed1 clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0xd91ed1)
#29 0x0000000000c4c4f4 main (/opt/compiler-explorer/clang-trunk/bin/clang+++0xc4c4f4)
#30 0x00007ca24c629d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#31 0x00007ca24c629e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#32 0x0000000000d8d025 _start (/opt/compiler-explorer/clang-trunk/bin/clang+++0xd8d025)
clang++: error: clang frontend command failed with exit code 139 (use -v to see invocation)
```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJzkWl-P4yj2_TTUC3Jk4795yIMrqcyv5lerLnVKq9mnCANOmLbBC7gmNZ9-BXbi2JVKdY_SI612lFGlMVzOOffCveBgrflOMLYA8T2IV3e4NXupFl9bvQ98FIZ3haRvi1-YYAobRmHxBsv2zz-ZgmaPDVRYUFlXb5ALzZTRECS-s3RPWaMYsWNAvLKfxIe6YYSXnClYsFIqBstWEMOlgFhQqI1qiYGUkQorbJv1DPg58PNnJQtcVG9QG2wnKZWsIamw2HkJCHO4N6bRIMwBWgO03klayMrMpNoBtP4ToDUJo38l8cvvore34XVTWSAUGqaNHenaLXj3IQDd24-fEym0YYdGwVfJKXxh2iQAZQDNoR2Q3ts_EELYai528OUFgnB1pHJZCfgybkzvQboC4X1ncHWOo4drMPkGV23dvEdq1Xl6yDcPULdFzQ3EsGh3ULFGKgONn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