<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/58399>58399</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Using Concept name as a Templated Struct name signals segfault
</td>
</tr>
<tr>
<th>Labels</th>
<td>
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
zawata
</td>
</tr>
</table>
<pre>
Got a crash after making a typo. Accidentally made a struct Specialization but the struct name was a already a concept name.
I expect that it's not so big a deal because it's invalid code...but it also probably shouldn't be segfault'ing either.
replicated on clang 15: https://godbolt.org/z/x6GMrar7f
Minimum reproducible example:
```c++
// cat test.cc
template<class T>
concept C1 = true;
template<typename A>
struct C1<A> {}
```
```
$ clang -std=c++20 test.cc
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: /usr/bin/clang-14 -cc1 -triple x86_64-pc-linux-gnu -emit-obj -mrelax-all --mrelax-relocations -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name test.cc -mrelocation-model pic -pic-level 2 -pic-is-pie -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -mllvm -treat-scalable-fixed-error-as-warning -debugger-tuning=gdb -fcoverage-compilation-dir=/home/johna/Documents/new-thing -resource-dir /usr/lib/clang/14.0.6 -internal-isystem /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.0/../../../../include/c++/12.2.0 -internal-isystem /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.0/../../../../include/c++/12.2.0/x86_64-pc-linux-gnu -internal-isystem /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.0/../../../../include/c++/12.2.0/backward -internal-isystem /usr/lib/clang/14.0.6/include -internal-isystem /usr/local/include -internal-isystem /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.0/../../../../x86_64-pc-linux-gnu/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -std=c++20 -fdeprecated-macro -fdebug-compilation-dir=/home/johna/Documents/new-thing -ferror-limit 19 -stack-protector 2 -fgnuc-version=4.2.1 -fno-implicit-modules -fcxx-exceptions -fexceptions -fcolor-diagnostics -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/test-22571b.o -x c++ test.cc
1. test.cc:5:14: current parser token '{'
#0 0x00007fd3004dd45a (/usr/lib/libLLVM-14.so+0xcd545a)
#1 0x00007fd3004daaef llvm::sys::RunSignalHandlers() (/usr/lib/libLLVM-14.so+0xcd2aef)
#2 0x00007fd3004dac3d (/usr/lib/libLLVM-14.so+0xcd2c3d)
#3 0x00007fd2ff422a00 (/usr/lib/libc.so.6+0x38a00)
#4 0x00007fd306faf7b0 clang::Diagnostic::FormatDiagnostic(char const*, char const*, llvm::SmallVectorImpl<char>&) const (/usr/lib/libclang-cpp.so.14+0x6eb7b0)
#5 0x00007fd306fb089f clang::Diagnostic::FormatDiagnostic(char const*, char const*, llvm::SmallVectorImpl<char>&) const (/usr/lib/libclang-cpp.so.14+0x6ec89f)
#6 0x00007fd306fb089f clang::Diagnostic::FormatDiagnostic(char const*, char const*, llvm::SmallVectorImpl<char>&) const (/usr/lib/libclang-cpp.so.14+0x6ec89f)
#7 0x00007fd306fb089f clang::Diagnostic::FormatDiagnostic(char const*, char const*, llvm::SmallVectorImpl<char>&) const (/usr/lib/libclang-cpp.so.14+0x6ec89f)
#8 0x00007fd306fb089f clang::Diagnostic::FormatDiagnostic(char const*, char const*, llvm::SmallVectorImpl<char>&) const (/usr/lib/libclang-cpp.so.14+0x6ec89f)
#9 0x00007fd306fb089f clang::Diagnostic::FormatDiagnostic(char const*, char const*, llvm::SmallVectorImpl<char>&) const (/usr/lib/libclang-cpp.so.14+0x6ec89f)
#10 0x00007fd306fb089f clang::Diagnostic::FormatDiagnostic(char const*, char const*, llvm::SmallVectorImpl<char>&) const (/usr/lib/libclang-cpp.so.14+0x6ec89f)
#11 0x00007fd3086a7602 clang::TextDiagnosticPrinter::HandleDiagnostic(clang::DiagnosticsEngine::Level, clang::Diagnostic const&) (/usr/lib/libclang-cpp.so.14+0x1de3602)
#12 0x00007fd306fa24b4 clang::DiagnosticIDs::ProcessDiag(clang::DiagnosticsEngine&) const (/usr/lib/libclang-cpp.so.14+0x6de4b4)
#13 0x00007fd306fa2778 clang::DiagnosticsEngine::EmitCurrentDiagnostic(bool) (/usr/lib/libclang-cpp.so.14+0x6de778)
#14 0x00007fd306fa281e (/usr/lib/libclang-cpp.so.14+0x6de81e)
#15 0x00007fd3070dfe8e clang::Parser::ParseClassSpecifier(clang::tok::TokenKind, clang::SourceLocation, clang::DeclSpec&, clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier, bool, clang::Parser::DeclSpecContext, clang::ParsedAttributesWithRange&) (/usr/lib/libclang-cpp.so.14+0x81be8e)
#16 0x00007fd3070c3657 clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&, clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier, clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*) (/usr/lib/libclang-cpp.so.14+0x7ff657)
#17 0x00007fd30714fe29 clang::Parser::ParseSingleDeclarationAfterTemplate(clang::DeclaratorContext, clang::Parser::ParsedTemplateInfo const&, clang::ParsingDeclRAIIObject&, clang::SourceLocation&, clang::ParsedAttributes&, clang::AccessSpecifier) (/usr/lib/libclang-cpp.so.14+0x88be29)
#18 0x00007fd307150c9f clang::Parser::ParseTemplateDeclarationOrSpecialization(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&, clang::AccessSpecifier) (/usr/lib/libclang-cpp.so.14+0x88cc9f)
#19 0x00007fd3071511e6 clang::Parser::ParseDeclarationStartingWithTemplate(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&, clang::AccessSpecifier) (/usr/lib/libclang-cpp.so.14+0x88d1e6)
#20 0x00007fd3070d7dbc clang::Parser::ParseDeclaration(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributesWithRange&, clang::SourceLocation*) (/usr/lib/libclang-cpp.so.14+0x813dbc)
#21 0x00007fd30715320c clang::Parser::ParseExternalDeclaration(clang::ParsedAttributesWithRange&, clang::ParsingDeclSpec*) (/usr/lib/libclang-cpp.so.14+0x88f20c)
#22 0x00007fd3071539f6 clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, bool) (/usr/lib/libclang-cpp.so.14+0x88f9f6)
#23 0x00007fd30709df18 clang::ParseAST(clang::Sema&, bool, bool) (/usr/lib/libclang-cpp.so.14+0x7d9f18)
#24 0x00007fd308677919 clang::FrontendAction::Execute() (/usr/lib/libclang-cpp.so.14+0x1db3919)
#25 0x00007fd308616e07 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/usr/lib/libclang-cpp.so.14+0x1d52e07)
#26 0x00007fd3086ce7ca clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/usr/lib/libclang-cpp.so.14+0x1e0a7ca)
#27 0x000055838cd0d6f1 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/usr/bin/clang-14+0x176f1)
#28 0x000055838cd0f337 (/usr/bin/clang-14+0x19337)
#29 0x000055838cd03216 main (/usr/bin/clang-14+0xd216)
#30 0x00007fd2ff40d290 (/usr/lib/libc.so.6+0x23290)
#31 0x00007fd2ff40d34a __libc_start_main (/usr/lib/libc.so.6+0x2334a)
#32 0x000055838cd05655 _start (/usr/bin/clang-14+0xf655)
clang-14: error: unable to execute command: Segmentation fault (core dumped)
clang-14: error: clang frontend command failed due to signal (use -v to see invocation)
clang version 14.0.6
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
clang-14: note: diagnostic msg:
********************
PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-14: note: diagnostic msg: /tmp/test-a77837.cpp
clang-14: note: diagnostic msg: /tmp/test-a77837.sh
clang-14: note: diagnostic msg:
********************
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzdWtty2zgS_Rr5BUUVLxJJPfhBke3Etc7aZXlmHl0gAEqcoQgtCDpKvn5Pk5Is0IpjJTOV3aQcScSl-_TpBhogkGn5-fy9towzYXi9ZDy3yrAV_6uoFii0n9d6yKZCFFJVlpflZ9RJhZramkZYNl8rUfCy-MJtoSuWNZbZpdrVVnyl2Cdeoz0vjeLyMynSlVDrrnI48C8G_rT7vGZqA3EkgVtW2EGY1KwCuFqzrCA4UvGSZUrwpla7BkX1BP0SYqUaDoeEoIA9JTqtjc54Bsz1UjelrNDeojur1SLnTUn9yUxVALJxoBi1LgvBrZIMVomSo1kwHkRTtrR2XePHILzC30LLTJd2qM0CT1_wfxO__2i4SfJDcR-Lqlg1KwaxRstGFFmpYCxfrUtFsrqmsd_9iUH4jv660lYPAxZmVW2HQnTlVqEzAA6iGeDVNXsYRJdd1Y7gWcAG0QWDK9Dq3SGeg87wsGrdNN333zpvFqCaStkgeTdILnoojz-Goy1bXm0ltG9tCX0X_d3N5XR-yeomW5GzEDcLIkcbWKn7HMM9TTYUeoWHsnzafXng8k-ECx6Lum5UTTzxSiIiRNkgSCkQu6jOuPjLGi7UIJwhKsgLQtU1vFvrxnTF1BM8aoQzud00FauFKdZ2GxhzCyFMNqv13mM-qiZ3Ri8MXzFuFs0Kg4SAM0BpaoPPrEDUXbWUeMGIeUIEzLMQiwDYpPFjPPLWwiuLqtl4i6phngIhns7-ZN7KqJJvPAw65u0e8KlFO9Rq5smiRnQrLzdKQXKpuPF4bb1M5dooj4xWMGrfriXtSZkiLzDGqVhwIz0Mn0Z5FAOQueJF5eVF2RXsnNaB2Wr2VhhpJVsXKMaHV6onPIbdQ1HjC2hWOThR3loXFSYUBEJrRr7idukpYyqNh3ztIVTJLxYNMM68vNKe0U0lMSw9agtBaNIFpIZ1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