Closed as not planned
Description
I encountered this with std=c++20 -Weverything
, of course -Wc++98-compat
is nonsense here.
clang++ -std=c++20 -Wc++98-compat test.cpp
crashes on the following input:
// test.cpp
template<unsigned N>
struct Str {
constexpr Str(char const (&str)[N]) {}
};
template<Str s>
auto test() {}
Stack dump:
0. Program arguments: /opt/compiler-explorer/clang-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++20 -Wc++98-compat -emit-llvm -Xclang -disable-llvm-passes <source>
1. <source>:6:15: current parser token '>'
#0 0x000055ed84f7ee14 PrintStackTraceSignalHandler(void*) Signals.cpp:0:0
#1 0x000055ed84f7cc7c llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x395cc7c)
#2 0x000055ed84eba588 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
#3 0x00007fb4bf7d3420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
#4 0x000055ed8810b29d ConvertTypeToDiagnosticString(clang::ASTContext&, clang::QualType, llvm::ArrayRef<std::pair<clang::DiagnosticsEngine::ArgumentKind, long>>, llvm::ArrayRef<long>) ASTDiagnostic.cpp:0:0
#5 0x000055ed8810c28c clang::FormatASTNodeDiagnosticArgument(clang::DiagnosticsEngine::ArgumentKind, long, llvm::StringRef, llvm::StringRef, llvm::ArrayRef<std::pair<clang::DiagnosticsEngine::ArgumentKind, long>>, llvm::SmallVectorImpl<char>&, void*, llvm::ArrayRef<long>) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x6aec28c)
#6 0x000055ed852cac07 clang::Diagnostic::FormatDiagnostic(char const*, char const*, llvm::SmallVectorImpl<char>&) const (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3caac07)
#7 0x000055ed85b456c4 clang::TextDiagnosticPrinter::HandleDiagnostic(clang::DiagnosticsEngine::Level, clang::Diagnostic const&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x45256c4)
#8 0x000055ed852d0ca1 clang::DiagnosticIDs::ProcessDiag(clang::DiagnosticsEngine&) const (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3cb0ca1)
#9 0x000055ed852c534b clang::DiagnosticsEngine::EmitCurrentDiagnostic(bool) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3ca534b)
#10 0x000055ed875278fb clang::Sema::EmitCurrentDiagnostic(unsigned int) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5f078fb)
#11 0x000055ed8752827f clang::Sema::ImmediateDiagBuilder::~ImmediateDiagBuilder() (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5f0827f)
#12 0x000055ed87528aab clang::Sema::SemaDiagnosticBuilder::~SemaDiagnosticBuilder() (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5f08aab)
#13 0x000055ed87ce23b0 clang::Sema::ActOnNonTypeTemplateParameter(clang::Scope*, clang::Declarator&, unsigned int, unsigned int, clang::SourceLocation, clang::Expr*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x66c23b0)
#14 0x000055ed874ccbdd clang::Parser::ParseNonTypeTemplateParameter(unsigned int, unsigned int) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5eacbdd)
#15 0x000055ed874d5a19 clang::Parser::ParseTemplateParameter(unsigned int, unsigned int) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5eb5a19)
#16 0x000055ed874d6769 clang::Parser::ParseTemplateParameterList(unsigned int, llvm::SmallVectorImpl<clang::NamedDecl*>&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5eb6769)
#17 0x000055ed874d6c06 clang::Parser::ParseTemplateParameters(clang::Parser::MultiParseScope&, unsigned int, llvm::SmallVectorImpl<clang::NamedDecl*>&, clang::SourceLocation&, clang::SourceLocation&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5eb6c06)
#18 0x000055ed874d96a6 clang::Parser::ParseTemplateDeclarationOrSpecialization(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&, clang::AccessSpecifier) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5eb96a6)
#19 0x000055ed874d9ad3 clang::Parser::ParseDeclarationStartingWithTemplate(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&, clang::AccessSpecifier) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5eb9ad3)
#20 0x000055ed8740a328 clang::Parser::ParseDeclaration(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&, clang::ParsedAttributes&, clang::SourceLocation*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5dea328)
#21 0x000055ed873db986 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsingDeclSpec*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5dbb986)
#22 0x000055ed873dd70a clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5dbd70a)
#23 0x000055ed873cd0aa clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5dad0aa)
#24 0x000055ed861e43b5 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-trunk/bin/clang+++0x4bc43b5)
#25 0x000055ed85ae9011 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-trunk/bin/clang+++0x44c9011)
#26 0x000055ed85a6fb63 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x444fb63)
#27 0x000055ed85bcc1db clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x45ac1db)
#28 0x000055ed8288b204 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x126b204)
#29 0x000055ed828847fb ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&) driver.cpp:0:0
#30 0x000055ed858dbe99 void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const::'lambda'()>(long) Job.cpp:0:0
#31 0x000055ed84ebacf7 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x389acf7)
#32 0x000055ed858dc0cc clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const (.part.0) Job.cpp:0:0
#33 0x000055ed858a7719 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-trunk/bin/clang+++0x4287719)
#34 0x000055ed858a810d 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+++0x428810d)
#35 0x000055ed858b285c clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x429285c)
#36 0x000055ed82888f29 clang_main(int, char**) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x1268f29)
#37 0x00007fb4bf281083 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24083)
#38 0x000055ed8288440e _start (/opt/compiler-explorer/clang-trunk/bin/clang+++0x126440e)