[clang]Clang assertion failure during CTAD when substituting invalid dependent type in constructor template parameter
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
**Clang crashes (ICE) when CTAD instantiates a class template whose constructor template has a parameter involving an invalid dependent member type (e.g. typename T::U with T=int).**
```cpp
template
struct A {
A(T){}
template
A(typename T::U...);
};
A a(0);
```
Output:
source:6:19: error: use 'template' keyword to treat 'U' as a dependent template name
6 | A(typename T::U...);
| ^
| template
source:6:16: error: type 'int' cannot be used prior to '::' because it has no members
6 | A(typename T::U...);
| ^
source:9:3: note: in instantiation of template class 'A' requested here
9 | A a(0);
| ^
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and dumped files.
Stack dump:
0. Program arguments: /opt/compiler-explorer/clang-assertions-trunk/bin/clang++ -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
1. source:9:7: current parser token ';'
2. source:2:8: instantiating class definition 'A'
#0 0x0000000004357da8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4357da8)
#1 0x0000000004354cd4 llvm::sys::RunSignalHandlers() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4354cd4)
#2 0x00000000043552f4 llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x43552f4)
#3 0x0000000004292c08 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
#4 0x000079acea045330 (/lib/x86_64-linux-gnu/libc.so.6+0x45330)
#5 0x0000000007e22b40 clang::ValueDecl::isParameterPack() const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x7e22b40)
#6 0x00000000077af3c5 clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformFunctionTypeParams(clang::SourceLocation, llvm::ArrayRef, clang::QualType const*, clang::FunctionType::ExtParameterInfo const*, llvm::SmallVectorImpl&, llvm::SmallVectorImpl*, clang::Sema::ExtParameterInfoBuilder&, unsigned int*) SemaTemplateInstantiate.cpp:0:0
#7 0x00000000077bdb81 clang::Sema::SubstFunctionDeclType(clang::TypeSourceInfo*, clang::MultiLevelTemplateArgumentList const&, clang::SourceLocation, clang::DeclarationName, clang::CXXRecordDecl*, clang::Qualifiers, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x77bdb81)
#8 0x0000000007814554 clang::TemplateDeclInstantiator::SubstFunctionType(clang::FunctionDecl*, llvm::SmallVectorImpl&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x7814554)
#9 0x0000000007877868 clang::TemplateDeclInstantiator::VisitCXXMethodDecl(clang::CXXMethodDecl*, clang::TemplateParameterList*, clang::TemplateDeclInstantiator::RewriteKind) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x7877868)
#10 0x000000000787bfca clang::TemplateDeclInstantiator::VisitFunctionTemplateDecl(clang::FunctionTemplateDecl*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x787bfca)
#11 0x000000000779be33 clang::Sema::InstantiateClassImpl(clang::SourceLocation, clang::CXXRecordDecl*, clang::CXXRecordDecl*, clang::MultiLevelTemplateArgumentList const&, clang::TemplateSpecializationKind, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x779be33)
#12 0x0000000007809d1a clang::Sema::InstantiateClassTemplateSpecialization(clang::SourceLocation, clang::ClassTemplateSpecializationDecl*, clang::TemplateSpecializationKind, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x7809d1a)
#13 0x000000000788ac1e void llvm::function_ref::callback_fn(long) SemaType.cpp:0:0
#14 0x000000000870cb31 clang::StackExhaustionHandler::runWithSufficientStackSpace(clang::SourceLocation, llvm::function_ref) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x870cb31)
#15 0x000000000789792e clang::Sema::RequireCompleteTypeImpl(clang::SourceLocation, clang::QualType, clang::Sema::CompleteTypeKind, clang::Sema::TypeDiagnoser*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x789792e)
#16 0x0000000007897daf clang::Sema::RequireCompleteType(clang::SourceLocation, clang::QualType, clang::Sema::CompleteTypeKind, clang::Sema::TypeDiagnoser&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x7897daf)
#17 0x0000000007898465 clang::Sema::RequireCompleteType(clang::SourceLocation, clang::QualType, clang::Sema::CompleteTypeKind, unsigned int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x7898465)
#18 0x0000000007020371 clang::Sema::AddInitializerToDecl(clang::Decl*, clang::Expr*, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x7020371)
#19 0x0000000006c663e9 clang::Parser::ParseDeclarationAfterDeclaratorAndAttributes(clang::Declarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::ForRangeInit*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6c663e9)
#20 0x0000000006c734da clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, clang::DeclaratorContext, clang::ParsedAttributes&, clang::Parser::ParsedTemplateInfo&, clang::SourceLocation*, clang::Parser::ForRangeInit*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6c734da)
#21 0x0000000006c3083b clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec&, clang::AccessSpecifier) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6c3083b)
#22 0x0000000006c3103f clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*, clang::AccessSpecifier) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6c3103f)
#23 0x0000000006c38ab1 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6c38ab1)
#24 0x0000000006c399c5 clang::Parser::ParseTopLevelDecl(clang::OpaquePtr&, clang::Sema::ModuleImportState&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6c399c5)
#25 0x0000000006c1a94a clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6c1a94a)
#26 0x0000000004e47118 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4e47118)
#27 0x0000000005173d08 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5173d08)
#28 0x00000000050fd22d clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x50fd22d)
#29 0x0000000005271a7d clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5271a7d)
#30 0x0000000000dce36c cc1_main(llvm::ArrayRef, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xdce36c)
#31 0x0000000000dc4faa ExecuteCC1Tool(llvm::SmallVectorImpl&, llvm::ToolContext const&, llvm::IntrusiveRefCntPtr) driver.cpp:0:0
#32 0x0000000000dc512d int llvm::function_ref&)>::callback_fn&)>(long, llvm::SmallVectorImpl&) driver.cpp:0:0
#33 0x0000000004eb99b9 void llvm::function_ref::callback_fn>, std::__cxx11::basic_string, std::allocator>*, bool*) const::'lambda'()>(long) Job.cpp:0:0
#34 0x0000000004293044 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4293044)
#35 0x0000000004eba006 clang::driver::CC1Command::Execute(llvm::ArrayRef>, std::__cxx11::basic_string, std::allocator>*, bool*) const (.part.0) Job.cpp:0:0
#36 0x0000000004e76132 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4e76132)
#37 0x0000000004e770de clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl>&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4e770de)
#38 0x0000000004e7e825 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4e7e825)
#39 0x0000000000dca852 clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xdca852)
#40 0x0000000000cc9f0a main (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xcc9f0a)
#41 0x000079acea02a1ca (/lib/x86_64-linux-gnu/libc.so.6+0x2a1ca)
#42 0x000079acea02a28b __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2a28b)
#43 0x0000000000dc4955 _start (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xdc4955)
clang++: error: clang frontend command failed due to signal (use -v to see invocation)
Compiler returned: 139
https://godbolt.org/z/sTjTz6Tvx
This crash is reproducible via CTAD on recent Clang versions (observed starting from **Clang 16**).
Further investigation shows that CTAD is not the root cause, but an additional instantiation path.
```cpp
template
void f(typename T::U...);
int main() {
f(0);
}
```
Output:
"source:2:20: error: use 'template' keyword to treat 'U' as a dependent template name
2 | void f(typename T::U...);
| ^
| template
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and dumped files.
Stack dump:
0. Program arguments: /opt/compiler-explorer/clang-assertions-trunk/bin/clang++ -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
1. :5:13: current parser token ')'
2. :4:12: parsing function body 'main'
3. :4:12: in compound statement ('{}')
#0 0x0000000004357da8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4357da8)
#1 0x0000000004354cd4 llvm::sys::RunSignalHandlers() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4354cd4)
#2 0x00000000043552f4 llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x43552f4)
#3 0x0000000004292c08 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
#4 0x0000779d85e45330 (/lib/x86_64-linux-gnu/libc.so.6+0x45330)
#5 0x0000000007e22b40 clang::ValueDecl::isParameterPack() const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x7e22b40)
#6 0x00000000077af3c5 clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformFunctionTypeParams(clang::SourceLocation, llvm::ArrayRef, clang::QualType const*, clang::FunctionType::ExtParameterInfo const*, llvm::SmallVectorImpl&, llvm::SmallVectorImpl*, clang::Sema::ExtParameterInfoBuilder&, unsigned int*) SemaTemplateInstantiate.cpp:0:0
#7 0x00000000077b2a80 clang::Sema::SubstParmTypes(clang::SourceLocation, llvm::ArrayRef, clang::FunctionType::ExtParameterInfo const*, clang::MultiLevelTemplateArgumentList const&, llvm::SmallVectorImpl&, llvm::SmallVectorImpl*, clang::Sema::ExtParameterInfoBuilder&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x77b2a80)
#8 0x00000000076bccb5 clang::Sema::SubstituteExplicitTemplateArguments(clang::FunctionTemplateDecl*, clang::TemplateArgumentListInfo&, llvm::SmallVectorImpl&, llvm::SmallVectorImpl&, clang::QualType*, clang::sema::TemplateDeductionInfo&) (.constprop.0) SemaTemplateDeduction.cpp:0:0
#9 0x00000000076bd110 void llvm::function_ref::callback_fn, clang::FunctionDecl*&, clang::sema::TemplateDeductionInfo&, bool, bool, bool, clang::QualType, clang::Expr::Classification, bool, llvm::function_ref, bool)>)::'lambda'()>(long) SemaTemplateDeduction.cpp:0:0
#10 0x000000000870cb31 clang::StackExhaustionHandler::runWithSufficientStackSpace(clang::SourceLocation, llvm::function_ref) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x870cb31)
#11 0x00000000076f43ee clang::Sema::DeduceTemplateArguments(clang::FunctionTemplateDecl*, clang::TemplateArgumentListInfo*, llvm::ArrayRef, clang::FunctionDecl*&, clang::sema::TemplateDeductionInfo&, bool, bool, bool, clang::QualType, clang::Expr::Classification, bool, llvm::function_ref, bool)>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x76f43ee)
#12 0x0000000007552b55 AddTemplateOverloadCandidateImmediately(clang::Sema&, clang::OverloadCandidateSet&, clang::FunctionTemplateDecl*, clang::DeclAccessPair, clang::TemplateArgumentListInfo*, llvm::ArrayRef, bool, bool, bool, clang::CallExpr::ADLCallKind, clang::OverloadCandidateParamOrder, bool) SemaOverload.cpp:0:0
#13 0x0000000007554f90 clang::Sema::AddTemplateOverloadCandidate(clang::FunctionTemplateDecl*, clang::DeclAccessPair, clang::TemplateArgumentListInfo*, llvm::ArrayRef, clang::OverloadCandidateSet&, bool, bool, bool, clang::CallExpr::ADLCallKind, clang::OverloadCandidateParamOrder, bool) (.constprop.1) SemaOverload.cpp:0:0
#14 0x00000000075551a3 AddOverloadedCallCandidate(clang::Sema&, clang::DeclAccessPair, clang::TemplateArgumentListInfo*, llvm::ArrayRef, clang::OverloadCandidateSet&, bool, bool) SemaOverload.cpp:0:0
#15 0x00000000075567e9 clang::Sema::AddOverloadedCallCandidates(clang::UnresolvedLookupExpr*, llvm::ArrayRef, clang::OverloadCandidateSet&, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x75567e9)
#16 0x0000000007556b5e clang::Sema::buildOverloadedCallSet(clang::Scope*, clang::Expr*, clang::UnresolvedLookupExpr*, llvm::MutableArrayRef, clang::SourceLocation, clang::OverloadCandidateSet*, clang::ActionResult*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x7556b5e)
#17 0x000000000756bd84 clang::Sema::BuildOverloadedCallExpr(clang::Scope*, clang::Expr*, clang::UnresolvedLookupExpr*, clang::SourceLocation, llvm::MutableArrayRef, clang::SourceLocation, clang::Expr*, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x756bd84)
#18 0x00000000071b923a clang::Sema::BuildCallExpr(clang::Scope*, clang::Expr*, clang::SourceLocation, llvm::MutableArrayRef, clang::SourceLocation, clang::Expr*, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x71b923a)
#19 0x00000000071be85f clang::Sema::ActOnCallExpr(clang::Scope*, clang::Expr*, clang::SourceLocation, llvm::MutableArrayRef, clang::SourceLocation, clang::Expr*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x71be85f)
#20 0x0000000006cb0a56 clang::Parser::ParsePostfixExpressionSuffix(clang::ActionResult) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6cb0a56)
#21 0x0000000006ca973a clang::Parser::ParseCastExpression(clang::CastParseKind, bool, bool&, clang::TypoCorrectionTypeBehavior, bool, bool*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6ca973a)
#22 0x0000000006cab9e7 clang::Parser::ParseCastExpression(clang::CastParseKind, bool, clang::TypoCorrectionTypeBehavior, bool, bool*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6cab9e7)
#23 0x0000000006caba79 clang::Parser::ParseAssignmentExpression(clang::TypoCorrectionTypeBehavior) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6caba79)
#24 0x0000000006cb00b9 clang::Parser::ParseExpression(clang::TypoCorrectionTypeBehavior) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6cb00b9)
#25 0x0000000006d38939 clang::Parser::ParseExprStatement(clang::Parser::ParsedStmtContext) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6d38939)
#26 0x0000000006d2feb4 clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector&, clang::Parser::ParsedStmtContext, clang::SourceLocation*, clang::ParsedAttributes&, clang::ParsedAttributes&, clang::LabelDecl*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6d2feb4)
#27 0x0000000006d30899 clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector&, clang::Parser::ParsedStmtContext, clang::SourceLocation*, clang::LabelDecl*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6d30899)
#28 0x0000000006d390be clang::Parser::ParseCompoundStatementBody(bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6d390be)
#29 0x0000000006d398da clang::Parser::ParseFunctionStatementBody(clang::Decl*, clang::Parser::ParseScope&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6d398da)
#30 0x0000000006c3d283 clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&, clang::Parser::ParsedTemplateInfo const&, clang::LateParsedAttrList*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6c3d283)
#31 0x0000000006c73ef6 clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, clang::DeclaratorContext, clang::ParsedAttributes&, clang::Parser::ParsedTemplateInfo&, clang::SourceLocation*, clang::Parser::ForRangeInit*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6c73ef6)
#32 0x0000000006c3083b clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec&, clang::AccessSpecifier) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6c3083b)
#33 0x0000000006c3103f clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*, clang::AccessSpecifier) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6c3103f)
#34 0x0000000006c38ab1 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6c38ab1)
#35 0x0000000006c399c5 clang::Parser::ParseTopLevelDecl(clang::OpaquePtr&, clang::Sema::ModuleImportState&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6c399c5)
#36 0x0000000006c1a94a clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6c1a94a)
#37 0x0000000004e47118 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4e47118)
#38 0x0000000005173d08 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5173d08)
#39 0x00000000050fd22d clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x50fd22d)
#40 0x0000000005271a7d clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5271a7d)
#41 0x0000000000dce36c cc1_main(llvm::ArrayRef, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xdce36c)
#42 0x0000000000dc4faa ExecuteCC1Tool(llvm::SmallVectorImpl&, llvm::ToolContext const&, llvm::IntrusiveRefCntPtr) driver.cpp:0:0
#43 0x0000000000dc512d int llvm::function_ref&)>::callback_fn&)>(long, llvm::SmallVectorImpl&) driver.cpp:0:0
#44 0x0000000004eb99b9 void llvm::function_ref::callback_fn>, std::__cxx11::basic_string, std::allocator>*, bool*) const::'lambda'()>(long) Job.cpp:0:0
#45 0x0000000004293044 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4293044)
#46 0x0000000004eba006 clang::driver::CC1Command::Execute(llvm::ArrayRef>, std::__cxx11::basic_string, std::allocator>*, bool*) const (.part.0) Job.cpp:0:0
#47 0x0000000004e76132 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4e76132)
#48 0x0000000004e770de clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl>&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4e770de)
#49 0x0000000004e7e825 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4e7e825)
#50 0x0000000000dca852 clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xdca852)
#51 0x0000000000cc9f0a main (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xcc9f0a)
#52 0x0000779d85e2a1ca (/lib/x86_64-linux-gnu/libc.so.6+0x2a1ca)
#53 0x0000779d85e2a28b __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2a28b)
#54 0x0000000000dc4955 _start (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xdc4955)
clang++: error: clang frontend command failed due to signal (use -v to see invocation)
Compiler returned: 139"
https://godbolt.org/z/WxsaxjjGE
The same crash is reproducible without CTAD in general template instantiation, and has been present since at least **Clang 10.0.0**.
> The issue occurs when:
>
> - substituting a dependent member type in a function parameter (`typename T::...`)
> - where `T` is instantiated with a non-class type (e.g. `int`)
> - during function type substitution (SubstFunctionDeclType)
Contributor guide
Research direction
Start by compiling the two reduced C++ reproducers with Clang assertions enabled and compare the crash stack. Read clang::TreeTransform::TransformFunctionTypeParams in SemaTemplateInstantiate.cpp, which the stack identifies as the failing entry point. Done means both invalid dependent-type cases produce diagnostics without an assertion failure or frontend crash.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100