<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/131530>131530</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang] ICE in clang 19.1.0, 20.1.0, trunk when accessing private member in concept
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
n-morales
</td>
</tr>
</table>
<pre>
Reproducer: https://godbolt.org/z/xon9j74Ke
```
Stack dump:
0. Program arguments: /opt/compiler-explorer/clang-trunk/bin/clang++ -gdwarf-4 -g -o /app/output.s -mllvm --x86-asm-syntax=intel -fno-verbose-asm -S --gcc-toolchain=/opt/compiler-explorer/gcc-snapshot -fcolor-diagnostics -fno-crash-diagnostics -std=c++23 -Wall -Wextra -pedantic -Werror <source> -isystem/opt/compiler-explorer/libs/nlohmann_json/v3.11.1/single_include
1. <eof> parser at end of file
#0 0x0000000003b6fdb8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3b6fdb8)
#1 0x0000000003b6defc llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3b6defc)
#2 0x0000000003abd778 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
#3 0x00007f61c8242520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#4 0x000000000719a100 clang::DeclContext::classof(clang::Decl const*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x719a100)
#5 0x00000000062c32de clang::Sema::HandleDelayedAccessCheck(clang::sema::DelayedDiagnostic&, clang::Decl*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x62c32de)
#6 0x00000000064a29b1 clang::Sema::PopParsingDeclaration(clang::Sema::DelayedDiagnosticsState, clang::Decl*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x64a29b1)
#7 0x00000000061f273d clang::Parser::ParseTemplateDeclarationOrSpecialization(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&, clang::AccessSpecifier) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x61f273d)
#8 0x00000000061f282f clang::Parser::ParseDeclarationStartingWithTemplate(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x61f282f)
#9 0x00000000061166e2 clang::Parser::ParseDeclaration(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&, clang::ParsedAttributes&, clang::SourceLocation*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x61166e2)
#10 0x00000000060cb932 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x60cb932)
#11 0x00000000060cd1a8 clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x60cd1a8)
#12 0x00000000060bb7ea clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x60bb7ea)
#13 0x00000000044ed26d clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-trunk/bin/clang+++0x44ed26d)
#14 0x00000000047d10d1 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-trunk/bin/clang+++0x47d10d1)
#15 0x000000000474fb1b clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x474fb1b)
#16 0x00000000048c0f03 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x48c0f03)
#17 0x0000000000d637b1 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0xd637b1)
#18 0x0000000000d5bfad ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#19 0x000000000453a569 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
#20 0x0000000003abdb93 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3abdb93)
#21 0x000000000453a789 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
#22 0x00000000044fdaad clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-trunk/bin/clang+++0x44fdaad)
#23 0x00000000044fea71 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+++0x44fea71)
#24 0x0000000004508e0c clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x4508e0c)
#25 0x0000000000d60581 clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0xd60581)
#26 0x0000000000c21bc4 main (/opt/compiler-explorer/clang-trunk/bin/clang+++0xc21bc4)
#27 0x00007f61c8229d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#28 0x00007f61c8229e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#29 0x0000000000d5ba45 _start (/opt/compiler-explorer/clang-trunk/bin/clang+++0xd5ba45)
clang++: error: clang frontend command failed with exit code 139 (use -v to see invocation)
Compiler returned: 139
```
Details of code that triggers this:
```cpp
class foo
{
struct bar {};
};
template< typename T >
concept is_foo_concept = std::same_as< foo::bar, T >;
```
Causes the ICE. `foo::bar` should be inaccessible here and this should fail to compile but without the ICE.
e.g.:
```cpp
template< typename T >
constexpr inline bool is_foo_impl = std::same_as< foo::bar, T >;
template< typename T >
concept is_foo_concept = is_foo_impl< T >;
```
Works as expected and gives the following error (which is correct):
```
<source>:16:56: error: 'bar' is a private member of 'foo'
16 | constexpr inline bool is_foo_impl = std::same_as< foo::bar, T >;
| ^
<source>:6:12: note: implicitly declared private here
6 | struct bar {};
| ^
1 error generated.
```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJzkWdFzmzwS_2uUFw0eENjghzw4dv1de71ppulcHz1CLFitkDhJOM73199I4ACOk_b7zu3LeZIxFtLub3-72l0BNYZXEuAWze_QfHNDW7tX-lYGtdJUgLnJVfF0-xkarYqWgUbxCu-tbQyKV4hsEdlWqsiVsDOlK0S2fyKyPSq5_JYm_wQUrtzfIuz_wtWDpew7Ltq6cevDVThD4fJeq0rTGlNdtTVI62RjRLaqsYhsmaobLkAHcGyE0qDdmKCyCqxu5XdEtjmXpzFE7hC5w0FVPFJdBgkOKhwoJ4w2jRPZ2qa1M4ODWohDjYPgmC0CaurAPElLjyjecGlB4KCUKjiAzpUBdx8HDzgIKsYCq5Rge8olijdvgnSTjaSN2SuLg5IpoXRQcFpJZSxnptPBNDX76bCxBYo3rLOFxDj4SoXAwVc4Wk1x0EBBpeXMjWitNEbx2qhWM0DxOxxw82Qs1G9CEzw3iGylUPuaSrn7ZpSj8BDPomgWIbI1XFYCdlwy0RbOj5FzFIrXoEqnpaHagMbUYpAFViUuuXDTMCJxiMNjePrE-aIs8gw7tp3L45V5Mt3FvebS-oD4oikDRLJhkqaPO2WsBlojskBkjbm0iCwxItn_EhmI3IXHHhMiyx5xdIa4gJJdQrwWQGXbfJIPvJJUIJK10m-fAgvlVFwNn0Mw4CMTfDQv0jTDaxc4n4Gp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