<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/62296>62296</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Crash on syntax error: `using MyClass::;`
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
HolyBlackCat
</td>
</tr>
</table>
<pre>
Here's the code, which I compile with `-std=c++20`.
```cpp
struct A
{
protected:
A(int) {}
};
struct B : A
{
using A::; // Intentional error here.
};
int main()
{
B b(42);
}
```
This crashes the compiler in addition to generating a diagnostic. Tested on Clang 16 and on trunk 9372e42fd027db8767c324369491b9314f6a218f on GodBolt.
```none
<source>:9:14: error: expected unqualified-id
using A::; // Intentional error here.
^
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-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 <source>
1. <source>:14:12: current parser token ';'
2. <source>:13:1: parsing function body 'main'
3. <source>:13:1: in compound statement ('{}')
#0 0x000055dcab24da6f llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x36f2a6f)
#1 0x000055dcab24ba9c llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x36f0a9c)
#2 0x000055dcab19d4e8 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
#3 0x00007f32903e7420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
#4 0x000055dcad8eed01 clang::Sema::computeDeclContext(clang::QualType) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5d93d01)
#5 0x000055dcad8cfe9e HasAccess(clang::Sema&, (anonymous namespace)::EffectiveContext const&, clang::CXXRecordDecl const*, clang::AccessSpecifier, (anonymous namespace)::AccessTarget const&) (.part.0) SemaAccess.cpp:0:0
#6 0x000055dcad8d0238 IsAccessible(clang::Sema&, (anonymous namespace)::EffectiveContext const&, (anonymous namespace)::AccessTarget&) SemaAccess.cpp:0:0
#7 0x000055dcad8d2ab8 CheckEffectiveAccess(clang::Sema&, (anonymous namespace)::EffectiveContext const&, clang::SourceLocation, (anonymous namespace)::AccessTarget&) SemaAccess.cpp:0:0
#8 0x000055dcad8d6e84 clang::Sema::HandleDelayedAccessCheck(clang::sema::DelayedDiagnostic&, clang::Decl*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5d7be84)
#9 0x000055dcadacc7e2 clang::Sema::PopParsingDeclaration(clang::Sema::DelayedDiagnosticsState, clang::Decl*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5f717e2)
#10 0x000055dcad78fdbe clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, clang::DeclaratorContext, clang::ParsedAttributes&, clang::SourceLocation*, clang::Parser::ForRangeInit*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5c34dbe)
#11 0x000055dcad7907f6 clang::Parser::ParseSimpleDeclaration(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&, clang::ParsedAttributes&, bool, clang::Parser::ForRangeInit*, clang::SourceLocation*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5c357f6)
#12 0x000055dcad790d07 clang::Parser::ParseDeclaration(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&, clang::ParsedAttributes&, clang::SourceLocation*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5c35d07)
#13 0x000055dcad83ee2e clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*, clang::ParsedAttributes&, clang::ParsedAttributes&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5ce3e2e)
#14 0x000055dcad83f6e3 clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5ce46e3)
#15 0x000055dcad8405aa clang::Parser::ParseCompoundStatementBody(bool) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5ce55aa)
#16 0x000055dcad841962 clang::Parser::ParseFunctionStatementBody(clang::Decl*, clang::Parser::ParseScope&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5ce6962)
#17 0x000055dcad75d821 clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5c02821)
#18 0x000055dcad78f46f clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, clang::DeclaratorContext, clang::ParsedAttributes&, clang::SourceLocation*, clang::Parser::ForRangeInit*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5c3446f)
#19 0x000055dcad757c97 clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec&, clang::AccessSpecifier) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5bfcc97)
#20 0x000055dcad758def clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*, clang::AccessSpecifier) (.part.0) Parser.cpp:0:0
#21 0x000055dcad760874 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5c05874)
#22 0x000055dcad761e2d clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5c06e2d)
#23 0x000055dcad7511aa clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5bf61aa)
#24 0x000055dcac3b1e25 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-trunk/bin/clang+++0x4856e25)
#25 0x000055dcabc9fb51 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-trunk/bin/clang+++0x4144b51)
#26 0x000055dcabc220a3 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x40c70a3)
#27 0x000055dcabd7fed3 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x4224ed3)
#28 0x000055dca8b5bb8c cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x1000b8c)
#29 0x000055dca8b5734f ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#30 0x000055dcaba7d4bd void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const::'lambda'()>(long) Job.cpp:0:0
#31 0x000055dcab19d947 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3642947)
#32 0x000055dcaba7d6fc clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const (.part.0) Job.cpp:0:0
#33 0x000055dcaba44adc clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3ee9adc)
#34 0x000055dcaba454cd 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+++0x3eea4cd)
#35 0x000055dcaba4fafc clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3ef4afc)
#36 0x000055dca8b598ff clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0xffe8ff)
#37 0x000055dca8a5a0e5 main (/opt/compiler-explorer/clang-trunk/bin/clang+++0xeff0e5)
#38 0x00007f328fe95083 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24083)
#39 0x000055dca8b5352e _start (/opt/compiler-explorer/clang-trunk/bin/clang+++0xff852e)
clang++: error: clang frontend command failed with exit code 139 (use -v to see invocation)
Compiler returned: 139
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzsWl1v27jS_jXKDWFDor4vcuHYzTaLLtq3Dl7snUGRI1snMqklqdT59wekZEdUbKftURcLnFOkrcLPmWeGMw8_iFLVlgPcevGdF69uSKt3Qt5-FPXLXU3o05Lom0Kwl9uPIMHDqUJ6B4gKBh5eom-7iu7QA6Ji31Q1oG-V3iEv8WdKMy9cUQ_fefgO-17izz1_5fkLL_G7H9o0XYnSsqUaLfr69K77aKTQQDUwL-yrEEJo4eGs4trDOTIt09Wx18oL-47OqHfICxdvxjYjtariW7Qwo5ufO-Thew_foweugetKcFIjkFJItAMJ80vzVFyjPam4hzMP52fmuUOFh7MIm9pT15PcRzS6Xx93lUJUErWDI84WV4kqjghjlZELaYG2wEESbTQgiFVky4XSFZ2jR1AaGBIcLWvCtyhIEOH2dy1b_oTyMMUQ4ZL5OGVFliYpDXEUJnmUB0UeBlGZEBxkpenxm2B3otZjw3HBoS8Kl0q0koIXfvDCRe6FiyAyeFvc7MehsTZELf-rJXVVVsBmFevR-SkToOEfL_7QlX759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