<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/75221>75221</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
crash on invalid after "error: 'foo' cannot be defined in a type alias template"
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang:frontend,
crash-on-invalid
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
wheatman
</td>
</tr>
</table>
<pre>
The following invalid code crashes on the current post 17 trunk(2e197602305be18b963928e6ae024a004a95af6d)
https://godbolt.org/z/e7GqqKEKf
```
template <class T> using foo = struct foo {
T size = 0;
};
foo a;
```
It triggers the following assert
```
clang++: /root/build/tools/clang/include/clang/AST/TypeNodes.inc:74:
clang::TypeInfo clang::ASTContext::getTypeInfoImpl(const clang::Type*) const:
Assertion `!T->isDependentType() && "should not see dependent types here"' failed.
```
The full dump is
```
<source>:1:39: error: 'foo' cannot be defined in a type alias template
1 | template <class T> using foo = struct foo {
| ^
clang++: /root/build/tools/clang/include/clang/AST/TypeNodes.inc:74: clang::TypeInfo clang::ASTContext::getTypeInfoImpl(const clang::Type*) const: Assertion `!T->isDependentType() && "should not see dependent types here"' failed.
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-assertions-trunk/bin/clang++ -gdwarf-4 -g -o /app/output.s -mllvm --x86-asm-syntax=intel -S --gcc-toolchain=/opt/compiler-explorer/gcc-snapshot -fcolor-diagnostics -fno-crash-diagnostics -std=c++14 -pedantic-errors <source>
1. <source>:4:6: current parser token ';'
#0 0x000000000379d408 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x379d408)
#1 0x000000000379b0ec llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x379b0ec)
#2 0x00000000036e3bd8 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
#3 0x00007f0798c42520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#4 0x00007f0798c969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
#5 0x00007f0798c42476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
#6 0x00007f0798c287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
#7 0x00007f0798c2871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
#8 0x00007f0798c39e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
#9 0x0000000006e9af1c clang::ASTContext::getTypeInfoImpl(clang::Type const*) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6e9af1c)
#10 0x0000000006e82df7 clang::ASTContext::getTypeInfo(clang::Type const*) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6e82df7)
#11 0x0000000006e9b09b clang::ASTContext::getTypeInfoInChars(clang::Type const*) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6e9b09b)
#12 0x0000000006e9b1b3 clang::ASTContext::getTypeInfoInChars(clang::QualType) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6e9b1b3)
#13 0x0000000007340f25 (anonymous namespace)::ItaniumRecordLayoutBuilder::LayoutField(clang::FieldDecl const*, bool) RecordLayoutBuilder.cpp:0:0
#14 0x00000000073427af (anonymous namespace)::ItaniumRecordLayoutBuilder::LayoutFields(clang::RecordDecl const*) RecordLayoutBuilder.cpp:0:0
#15 0x000000000733e076 clang::ASTContext::getASTRecordLayout(clang::RecordDecl const*) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x733e076)
#16 0x0000000006e9ac51 clang::ASTContext::getTypeInfoImpl(clang::Type const*) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6e9ac51)
#17 0x0000000006e82df7 clang::ASTContext::getTypeInfo(clang::Type const*) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6e82df7)
#18 0x0000000006e99db7 clang::ASTContext::getTypeAlignInChars(clang::QualType) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6e99db7)
#19 0x000000000613ca20 clang::Sema::CheckArgAlignment(clang::SourceLocation, clang::NamedDecl*, llvm::StringRef, clang::QualType, clang::QualType) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x613ca20)
#20 0x000000000616e327 clang::Sema::CheckConstructorCall(clang::FunctionDecl*, clang::QualType, llvm::ArrayRef<clang::Expr const*>, clang::FunctionProtoType const*, clang::SourceLocation) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x616e327)
#21 0x000000000635cebc clang::Sema::CompleteConstructorCall(clang::CXXConstructorDecl*, clang::QualType, llvm::MutableArrayRef<clang::Expr*>, clang::SourceLocation, llvm::SmallVectorImpl<clang::Expr*>&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x635cebc)
#22 0x00000000066a6050 PerformConstructorInitialization(clang::Sema&, clang::InitializedEntity const&, clang::InitializationKind const&, llvm::MutableArrayRef<clang::Expr*>, clang::InitializationSequence::Step const&, bool&, bool, bool, clang::SourceLocation, clang::SourceLocation) SemaInit.cpp:0:0
#23 0x00000000066b93f2 clang::InitializationSequence::Perform(clang::Sema&, clang::InitializedEntity const&, clang::InitializationKind const&, llvm::MutableArrayRef<clang::Expr*>, clang::QualType*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x66b93f2)
#24 0x00000000062b5114 clang::Sema::ActOnUninitializedDecl(clang::Decl*) (.part.0) SemaDecl.cpp:0:0
#25 0x0000000005f872d6 clang::Parser::ParseDeclarationAfterDeclaratorAndAttributes(clang::Declarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::ForRangeInit*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5f872d6)
#26 0x0000000005f96170 clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, clang::DeclaratorContext, clang::ParsedAttributes&, clang::SourceLocation*, clang::Parser::ForRangeInit*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5f96170)
#27 0x0000000005f5f42b clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec&, clang::AccessSpecifier) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5f5f42b)
#28 0x0000000005f5fbb1 clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*, clang::AccessSpecifier) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5f5fbb1)
#29 0x0000000005f66e66 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5f66e66)
#30 0x0000000005f67d0d clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5f67d0d)
#31 0x0000000005f5acfa clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5f5acfa)
#32 0x000000000401e378 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x401e378)
#33 0x000000000428a9b9 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x428a9b9)
#34 0x0000000004208c9e clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4208c9e)
#35 0x000000000436974e clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x436974e)
#36 0x0000000000c01496 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xc01496)
#37 0x0000000000bf8d2a ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#38 0x000000000405f3a9 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
#39 0x00000000036e4084 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x36e4084)
#40 0x000000000405f99f 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
#41 0x0000000004027c05 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4027c05)
#42 0x000000000402866d clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x402866d)
#43 0x0000000004030585 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4030585)
#44 0x0000000000bfe90c clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xbfe90c)
#45 0x0000000000af7a71 main (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xaf7a71)
#46 0x00007f0798c29d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#47 0x00007f0798c29e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#48 0x0000000000bf880e _start (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xbf880e)
clang++: error: clang frontend command failed with exit code 134 (use -v to see invocation)
Compiler returned: 134
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzkW1tz2zYW_jX0C4YaEqR4efCDIltdt2mTrbw7fdOA4KGEDQUwAOjY_fU7ACmJoCTH3ljudDbjuhIuB9_5zgWHBEyUYmsOcO1NP3jTmyvS6o2Q1982QPSW8KtClE_X9xtAlahr8Y3xNWL8gdSsRFSUgKgkagMKCY70BhBtpQSuUSOURmGKtGz5Fw9nGMI8TQIcBdMCwqzIkyjHGSQEAhyTIIhJPiVVUno494IbL5httG6UF808vPDwYi3KQtR6IuTaw4s_PbyA9KevX3-5_aXqhve_k6D_sV81bJuaaEBeNKc1UQrde9EtapXRohICedENUlq2VHdf0w_dRITukWJ_gh0QeFHf7KU3-89mPDn0uAt3v-800pKt1yCV5ebAIFEKpD45ldaErz38wfxEM-ThhRRCe3hRtKwuPbzQQtTKw4t-4IJxWrclDFpmy3sPL-6fGvhNlKAmjFMvmqWxlTdYJJp50cwMu-OVQIO22fJ-LriGR919X4PeDbvbNrWHMyq40mgkxsMzD-fI9h3WmlldmeDI6IjDe9-Lbpm6gQZ4CVx3MzMz08OJhxPkYaw2oq1LxIVGCgCVu8FIPzWg0AYkeBh7OEUVYTWUk5NcWrdt6xqV7bZBTJ22VTRXopUUvOjWi2ahF82i3MAHKYXsbJBWQpjFKOEGUmEQVYxDiRhHxIJCpGZEoZ3L7fwIoRB56Rz9gCuaf0aEN719Fxd5H-d4T7f4_PF2trxFqi22TCOCinaNJDRCaqQFGmUapjdtMaFi6-FFXT_s_uc3UvwHqKGZKdWC4RcRbjzAkttlP5MMUUHoFy0JBQ_PUSOhkYKCUlCi3tHw3M4kSgnKiIYSyZYjRSVrdA95qQn9Yv3WILNNwcQL8s9SrCXZIiLX7Ra4Vr0HiMYgo2LbsBqkD49NLSTIncl9sqNb-X1KXhSMHzzCOBPy1-U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