Open
Description
$ cat preprocessed.cc
template <a> long b();
template <typename f = int> struct g {
using h = decltype(b<f>());
h m_fn1();
};
auto o = g();
long a(o.m_fn1());
$ ~/repos/llvm/build/bin/clang -Wno-everything -std=c++20 -xc++ preprocessed.cc
preprocessed.cc:1:11: error: unknown type name 'a'
1 | template <a> long b();
| ^
preprocessed.cc:3:22: error: no matching function for call to 'b'
3 | using h = decltype(b<f>());
| ^~~~
preprocessed.cc:6:10: note: in instantiation of template class 'g<>' requested here
6 | auto o = g();
| ^
preprocessed.cc:1:19: note: candidate template ignored: invalid explicitly-specified argument for 1st template parameter
1 | template <a> long b();
| ^
clang-20: /usr/local/google/home/kadircet/repos/llvm/clang/include/clang/AST/Type.h:957: const ExtQualsTypeCommonBase *clang::QualType::getCommonPtr() const: Assertion `!isNull() && "Cannot retrieve a NULL type pointer"' 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: /usr/local/google/home/kadircet/repos/llvm/build/bin/clang-20 -cc1 -triple x86_64-unknown-linux-gnu -emit-obj -dumpdir a- -disable-free -clear-ast-before-backend -main-file-name preprocessed.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 -debugger-tuning=gdb -fdebug-compilation-dir=/usr/local/google/home/kadircet/repos/tmp/clangd_crashes/68c6c10f-0000-2aaf-8985-3c286d3cf65a/0 -fcoverage-compilation-dir=/usr/local/google/home/kadircet/repos/tmp/clangd_crashes/68c6c10f-0000-2aaf-8985-3c286d3cf65a/0 -resource-dir /usr/local/google/home/kadircet/repos/llvm/build/lib/clang/20 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/14/../../../../include/x86_64-linux-gnu/c++/14 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/backward -internal-isystem /usr/local/google/home/kadircet/repos/llvm/build/lib/clang/20/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/14/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -Wno-everything -std=c++20 -fdeprecated-macro -ferror-limit 19 -fgnuc-version=4.2.1 -fno-implicit-modules -fskip-odr-check-in-gmf -fcxx-exceptions -fexceptions -fcolor-diagnostics -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/preprocessed-1b3d70.o -x c++ preprocessed.cc
1. preprocessed.cc:7:18: current parser token ';'
#0 0x00005624ec1b76e8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /usr/local/google/home/kadircet/repos/llvm/llvm/lib/Support/Unix/Signals.inc:723:13
#1 0x00005624ec1b52be llvm::sys::RunSignalHandlers() /usr/local/google/home/kadircet/repos/llvm/llvm/lib/Support/Signals.cpp:106:18
#2 0x00005624ec1b7d98 SignalHandler(int) /usr/local/google/home/kadircet/repos/llvm/llvm/lib/Support/Unix/Signals.inc:413:1
#3 0x00007f29f32591a0 (/lib/x86_64-linux-gnu/libc.so.6+0x3d1a0)
#4 0x00007f29f32a70ec __pthread_kill_implementation ./nptl/pthread_kill.c:44:76
#5 0x00007f29f3259102 gsignal ./signal/../sysdeps/posix/raise.c:27:6
#6 0x00007f29f32424f2 abort ./stdlib/abort.c:81:7
#7 0x00007f29f3242415 _nl_load_domain ./intl/loadmsgcat.c:1177:9
#8 0x00007f29f3251d32 (/lib/x86_64-linux-gnu/libc.so.6+0x35d32)
#9 0x00005624ef975993 doit /usr/local/google/home/kadircet/repos/llvm/llvm/include/llvm/Support/Casting.h:109:5
#10 0x00005624ef975993 doit /usr/local/google/home/kadircet/repos/llvm/llvm/include/llvm/Support/Casting.h:137:12
#11 0x00005624ef975993 doit /usr/local/google/home/kadircet/repos/llvm/llvm/include/llvm/Support/Casting.h:127:12
#12 0x00005624ef975993 isPossible /usr/local/google/home/kadircet/repos/llvm/llvm/include/llvm/Support/Casting.h:255:12
#13 0x00005624ef975993 isPossible /usr/local/google/home/kadircet/repos/llvm/llvm/include/llvm/Support/Casting.h:509:12
#14 0x00005624ef975993 isa<clang::ArrayType, clang::QualType> /usr/local/google/home/kadircet/repos/llvm/llvm/include/llvm/Support/Casting.h:549:10
#15 0x00005624ef975993 isArrayType /usr/local/google/home/kadircet/repos/llvm/clang/include/clang/AST/Type.h:8076:10
#16 0x00005624ef975993 EvaluateInPlace(clang::APValue&, (anonymous namespace)::EvalInfo&, (anonymous namespace)::LValue const&, clang::Expr const*, bool) /usr/local/google/home/kadircet/repos/llvm/clang/lib/AST/ExprConstant.cpp:0:0
#17 0x00005624ef976097 clang::Expr::EvaluateAsInitializer(clang::APValue&, clang::ASTContext const&, clang::VarDecl const*, llvm::SmallVectorImpl<std::pair<clang::SourceLocation, clang::PartialDiagnostic>>&, bool) const /usr/local/google/home/kadircet/repos/llvm/clang/lib/AST/ExprConstant.cpp:16312:12
#18 0x00005624ef8d3fbf clang::VarDecl::evaluateValueImpl(llvm::SmallVectorImpl<std::pair<clang::SourceLocation, clang::PartialDiagnostic>>&, bool) const /usr/local/google/home/kadircet/repos/llvm/clang/lib/AST/Decl.cpp:2572:32
#19 0x00005624ef8d4117 clang::VarDecl::checkForConstantInitialization(llvm::SmallVectorImpl<std::pair<clang::SourceLocation, clang::PartialDiagnostic>>&) const /usr/local/google/home/kadircet/repos/llvm/clang/lib/AST/Decl.cpp:2640:35
#20 0x00005624eeb10f68 clang::Sema::CheckCompleteVariableDeclaration(clang::VarDecl*) /usr/local/google/home/kadircet/repos/llvm/clang/lib/Sema/SemaDecl.cpp:0:27
#21 0x00005624eeb0fc1f clang::Sema::AddInitializerToDecl(clang::Decl*, clang::Expr*, bool) /usr/local/google/home/kadircet/repos/llvm/clang/lib/Sema/SemaDecl.cpp:0:3
#22 0x00005624ee8344b0 InitializerScopeRAII /usr/local/google/home/kadircet/repos/llvm/clang/lib/Parse/ParseDecl.cpp:2670:11
#23 0x00005624ee8344b0 clang::Parser::ParseDeclarationAfterDeclaratorAndAttributes(clang::Declarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::ForRangeInit*) /usr/local/google/home/kadircet/repos/llvm/clang/lib/Parse/ParseDecl.cpp:2842:26
#24 0x00005624ee831ac0 clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, clang::DeclaratorContext, clang::ParsedAttributes&, clang::Parser::ParsedTemplateInfo&, clang::SourceLocation*, clang::Parser::ForRangeInit*) /usr/local/google/home/kadircet/repos/llvm/clang/lib/Parse/ParseDecl.cpp:2523:7
#25 0x00005624ee7ba579 clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec&, clang::AccessSpecifier) /usr/local/google/home/kadircet/repos/llvm/clang/lib/Parse/Parser.cpp:0:10
#26 0x00005624ee7b9d92 clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*, clang::AccessSpecifier) /usr/local/google/home/kadircet/repos/llvm/clang/lib/Parse/Parser.cpp:1266:12
#27 0x00005624ee7b8b79 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) /usr/local/google/home/kadircet/repos/llvm/clang/lib/Parse/Parser.cpp:0:14
#28 0x00005624ee7b6bba clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) /usr/local/google/home/kadircet/repos/llvm/clang/lib/Parse/Parser.cpp:758:10
#29 0x00005624ee7b210e clang::ParseAST(clang::Sema&, bool, bool) /usr/local/google/home/kadircet/repos/llvm/clang/lib/Parse/ParseAST.cpp:170:5
#30 0x00005624ece66a3f clang::FrontendAction::Execute() /usr/local/google/home/kadircet/repos/llvm/clang/lib/Frontend/FrontendAction.cpp:1082:10
#31 0x00005624ecdd1a9d getPtr /usr/local/google/home/kadircet/repos/llvm/llvm/include/llvm/Support/Error.h:279:42
#32 0x00005624ecdd1a9d operator bool /usr/local/google/home/kadircet/repos/llvm/llvm/include/llvm/Support/Error.h:242:16
#33 0x00005624ecdd1a9d clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) /usr/local/google/home/kadircet/repos/llvm/clang/lib/Frontend/CompilerInstance.cpp:1061:23
#34 0x00005624ecf4ebfe clang::ExecuteCompilerInvocation(clang::CompilerInstance*) /usr/local/google/home/kadircet/repos/llvm/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:280:25
#35 0x00005624e9a4ae2b cc1_main(llvm::ArrayRef<char const*>, char const*, void*) /usr/local/google/home/kadircet/repos/llvm/clang/tools/driver/cc1_main.cpp:285:15
#36 0x00005624e9a4750d ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) /usr/local/google/home/kadircet/repos/llvm/clang/tools/driver/driver.cpp:215:12
#37 0x00005624e9a462b8 clang_main(int, char**, llvm::ToolContext const&) /usr/local/google/home/kadircet/repos/llvm/clang/tools/driver/driver.cpp:256:12
#38 0x00005624e9a57c67 main /usr/local/google/home/kadircet/repos/llvm/build/tools/clang/tools/driver/clang-driver.cpp:17:10
#39 0x00007f29f3243b8a __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:74:3
#40 0x00007f29f3243c45 call_init ./csu/../csu/libc-start.c:128:20
#41 0x00007f29f3243c45 __libc_start_main ./csu/../csu/libc-start.c:347:5
#42 0x00005624e9a44e61 _start (/usr/local/google/home/kadircet/repos/llvm/build/bin/clang-20+0x56c0e61)
clang: error: unable to execute command: Aborted
clang: error: clang frontend command failed due to signal (use -v to see invocation)
clang version 20.0.0git ([email protected]:kadircet/llvm-project.git 48b7a2c9ebbb5d8ea6be53ef034d2e67558ef97c)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/google/home/kadircet/repos/llvm/build/bin
Build config: +assertions
clang: note: diagnostic msg:
********************
PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang: note: diagnostic msg: /tmp/preprocessed-ca391b.cpp
clang: note: diagnostic msg: /tmp/preprocessed-ca391b.sh
clang: note: diagnostic msg:
********************