Skip to content

ICE in clang::Sema::ActOnUsingEnumDeclaration given invalid using enum B::E; #23

@Quuxplusone

Description

@Quuxplusone

https://godbolt.org/z/e9EPndKoY

struct D {
  using enum B::E;
};

Compile with clang++ -std=c++20 test.cpp. Clang trunk assert-fails:

<source>:2:14: error: use of undeclared identifier 'B'
    2 |   using enum B::E;
      |              ^
clang++: /root/llvm-project/clang/lib/Sema/SemaDeclCXX.cpp:12357: clang::Decl* clang::Sema::ActOnUsingEnumDeclaration(clang::Scope*, clang::AccessSpecifier, clang::SourceLocation, clang::SourceLocation, clang::SourceLocation, clang::IdentifierInfo&, clang::CXXScopeSpec*): Assertion `!SS->isInvalid() && "ScopeSpec is invalid"' 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 -S --gcc-toolchain=/opt/compiler-explorer/gcc-snapshot -fcolor-diagnostics -fno-crash-diagnostics -std=c++23 <source>
1.	<source>:2:18: current parser token ';'
2.	<source>:1:1: parsing struct/union/class body 'D'
 #0 0x00000000037c45b8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x37c45b8)
 #1 0x00000000037c229c llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x37c229c)
 #2 0x000000000370a0e8 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
 #3 0x00007fa39e242520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #4 0x00007fa39e2969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
 #5 0x00007fa39e242476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
 #6 0x00007fa39e2287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
 #7 0x00007fa39e22871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
 #8 0x00007fa39e239e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
 #9 0x00000000063def42 clang::Sema::ActOnUsingEnumDeclaration(clang::Scope*, clang::AccessSpecifier, clang::SourceLocation, clang::SourceLocation, clang::SourceLocation, clang::IdentifierInfo&, clang::CXXScopeSpec*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x63def42)
#10 0x00000000060115ff clang::Parser::ParseUsingDeclaration(clang::DeclaratorContext, clang::Parser::ParsedTemplateInfo const&, clang::SourceLocation, clang::SourceLocation&, clang::ParsedAttributes&, clang::AccessSpecifier) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x60115ff)

llvm#57347 is related, at least in that it's another case of ActOnUsingEnumDeclaration not handling syntax errors very well.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions