-
Notifications
You must be signed in to change notification settings - Fork 14.7k
Open
Labels
clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"crash-on-invalidregression:19Regression in 19 releaseRegression in 19 release
Description
I happened to notice this while looking at an unrelated LLVM failure.
The following case compiles successfully:
#include <utility>
struct c {
void d() noexcept(std::is_nothrow_swappable_v< int > &&
std::is_nothrow_swappable_v< int >);
};
However if I remove the include statement then as well as some genuine-looking errors, I also get an assertion failure:
https://godbolt.org/z/b7orMY3jM
struct c {
void d() noexcept(std::is_nothrow_swappable_v< int > &&
std::is_nothrow_swappable_v< int >);
};
<source>:4:21: error: use of undeclared identifier 'std'
4 | void d() noexcept(std::is_nothrow_swappable_v< int > &&
| ^
<source>:4:54: error: expected '(' for function-style cast or type construction
4 | void d() noexcept(std::is_nothrow_swappable_v< int > &&
| ~~~ ^
<source>:5:24: error: expected ')'
5 | std::is_nothrow_swappable_v< int >);
| ^
<source>:4:20: note: to match this '('
4 | void d() noexcept(std::is_nothrow_swappable_v< int > &&
| ^
clang-22: /root/llvm-project/llvm/tools/clang/lib/Sema/SemaDecl.cpp:2241: void clang::Sema::ActOnPopScope(clang::SourceLocation, clang::Scope*): Assertion `(S->getFlags() & (Scope::DeclScope | Scope::TemplateParamScope)) && "Scope shouldn't contain decls!"' 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-20250811/bin/clang-22 -cc1 -triple x86_64-unknown-linux-gnu -emit-obj -dumpdir /app/output.s- -disable-free -clear-ast-before-backend -main-file-name example.cpp -mrelocation-model pic -pic-level 2 -pic-is-pie -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -fno-verbose-asm -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debug-info-kind=constructor -dwarf-version=4 -debugger-tuning=gdb -fdebug-compilation-dir=/app -fcoverage-compilation-dir=/app -resource-dir /opt/compiler-explorer/clang-assertions-trunk-20250811/lib/clang/22 -internal-isystem /opt/compiler-explorer/gcc-snapshot/lib/gcc/x86_64-linux-gnu/16.0.0/../../../../include/c++/16.0.0 -internal-isystem /opt/compiler-explorer/gcc-snapshot/lib/gcc/x86_64-linux-gnu/16.0.0/../../../../include/c++/16.0.0/x86_64-linux-gnu -internal-isystem /opt/compiler-explorer/gcc-snapshot/lib/gcc/x86_64-linux-gnu/16.0.0/../../../../include/c++/16.0.0/backward -internal-isystem /opt/compiler-explorer/clang-assertions-trunk-20250811/lib/clang/22/include -internal-isystem /usr/local/include -internal-isystem /opt/compiler-explorer/gcc-snapshot/lib/gcc/x86_64-linux-gnu/16.0.0/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -fdeprecated-macro -ferror-limit 19 -fgnuc-version=4.2.1 -fskip-odr-check-in-gmf -fcxx-exceptions -fexceptions -fcolor-diagnostics -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/example-19df18.o -x c++ <source>
1. <source>:6:2: current parser token ';'
2. <source>:3:1: parsing struct/union/class body 'c'
#0 0x000000000400b248 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk-20250811/bin/clang-22+0x400b248)
#1 0x00000000040080f4 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
#2 0x00007209a6842520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#3 0x00007209a68969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
#4 0x00007209a6842476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
#5 0x00007209a68287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
#6 0x00007209a682871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
#7 0x00007209a6839e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
#8 0x0000000006a61cc9 clang::Sema::ActOnPopScope(clang::SourceLocation, clang::Scope*) (/opt/compiler-explorer/clang-assertions-trunk-20250811/bin/clang-22+0x6a61cc9)
#9 0x00000000066ad735 clang::Parser::ExitScope() (/opt/compiler-explorer/clang-assertions-trunk-20250811/bin/clang-22+0x66ad735)
#10 0x00000000066d50d8 clang::Parser::ParseLexedMethodDeclaration(clang::Parser::LateParsedMethodDeclaration&) (/opt/compiler-explorer/clang-assertions-trunk-20250811/bin/clang-22+0x66d50d8)
#11 0x00000000066ca8fd clang::Parser::ParseLexedMethodDeclarations(clang::Parser::ParsingClass&) (/opt/compiler-explorer/clang-assertions-trunk-20250811/bin/clang-22+0x66ca8fd)
#12 0x000000000671dff2 clang::Parser::ParseCXXMemberSpecification(clang::SourceLocation, clang::SourceLocation, clang::ParsedAttributes&, unsigned int, clang::Decl*) (/opt/compiler-explorer/clang-assertions-trunk-20250811/bin/clang-22+0x671dff2)
#13 0x0000000006720df0 clang::Parser::ParseClassSpecifier(clang::tok::TokenKind, clang::SourceLocation, clang::DeclSpec&, clang::Parser::ParsedTemplateInfo&, clang::AccessSpecifier, bool, clang::Parser::DeclSpecContext, clang::ParsedAttributes&) (/opt/compiler-explorer/clang-assertions-trunk-20250811/bin/clang-22+0x6720df0)
#14 0x00000000066f413e clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&, clang::Parser::ParsedTemplateInfo&, clang::AccessSpecifier, clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*, clang::ImplicitTypenameContext) (/opt/compiler-explorer/clang-assertions-trunk-20250811/bin/clang-22+0x66f413e)
#15 0x00000000066af698 clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec&, clang::AccessSpecifier) (/opt/compiler-explorer/clang-assertions-trunk-20250811/bin/clang-22+0x66af698)
#16 0x00000000066b00cf clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*, clang::AccessSpecifier) (/opt/compiler-explorer/clang-assertions-trunk-20250811/bin/clang-22+0x66b00cf)
#17 0x00000000066b78a3 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) (/opt/compiler-explorer/clang-assertions-trunk-20250811/bin/clang-22+0x66b78a3)
#18 0x00000000066b87b5 clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/opt/compiler-explorer/clang-assertions-trunk-20250811/bin/clang-22+0x66b87b5)
#19 0x00000000066b8c70 clang::Parser::ParseFirstTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/opt/compiler-explorer/clang-assertions-trunk-20250811/bin/clang-22+0x66b8c70)
#20 0x00000000066aa983 clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk-20250811/bin/clang-22+0x66aa983)
#21 0x00000000049b0c98 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk-20250811/bin/clang-22+0x49b0c98)
#22 0x0000000004ca50a5 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk-20250811/bin/clang-22+0x4ca50a5)
#23 0x0000000004c213be clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk-20250811/bin/clang-22+0x4c213be)
#24 0x0000000004d967f1 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk-20250811/bin/clang-22+0x4d967f1)
#25 0x0000000000daf0bf cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk-20250811/bin/clang-22+0xdaf0bf)
#26 0x0000000000da5d6a ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#27 0x0000000000daa402 clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk-20250811/bin/clang-22+0xdaa402)
#28 0x0000000000c5f604 main (/opt/compiler-explorer/clang-assertions-trunk-20250811/bin/clang-22+0xc5f604)
#29 0x00007209a6829d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#30 0x00007209a6829e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#31 0x0000000000da5815 _start (/opt/compiler-explorer/clang-assertions-trunk-20250811/bin/clang-22+0xda5815)
clang++: error: unable to execute command: Aborted (core dumped)
clang++: error: clang frontend command failed due to signal (use -v to see invocation)
Compiler returned: 254
Metadata
Metadata
Assignees
Labels
clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"crash-on-invalidregression:19Regression in 19 releaseRegression in 19 release
Type
Projects
Status
No status