<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/115513>115513</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [clang] Assertion `!isExprSubstitutionFailure() && "ExprRequirement has no expression because there has been a " "substitution failure."' failed.
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            c++20,
            clang:frontend,
            crash-on-invalid,
            clang:frontend:fuzzer
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          yijan4845
      </td>
    </tr>
</table>

<pre>
    **This testcase is generated by a fuzzer.**

Compiler Explorer: [https://godbolt.org/z/rKPxYf1MW](https://godbolt.org/z/rKPxYf1MW)

This invalid code will crash on clang assertion trunk with `-std=c++20`:
```cpp
template<typename T, typename U>
constexpr bool is_same_v = false;

template<typename T>
constexpr bool is_same_v<T, T> = true;

template<typename T, typename U>
concept Same = is_same_v<T, U>;

int foo1() {
 error;error;error;error;error;error;
 error;error;error;error;error;error;
 error;error;error;error;error;error;
 error;error;error;error;error;error;
}

template<auto a = 0>
requires requires (int b) {
  { a } -> Same<int>;
  { b } -> Same<int&>;
} void f1() {}
```

It seems that this goes back to clang-10.

Stack dump:
```
clang++: /root/llvm-project/clang/include/clang/AST/ExprConcepts.h:416: clang::Expr* clang::concepts::ExprRequirement::getExpr() const: Assertion `!isExprSubstitutionFailure() && "ExprRequirement has no expression because there has been a " "substitution failure."' 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 -mllvm --x86-asm-syntax=intel -fno-verbose-asm -S --gcc-toolchain=/opt/compiler-explorer/gcc-snapshot -fcolor-diagnostics -fno-crash-diagnostics -std=c++20 <source>
1.      <source>:21:3: current parser token 'void'
 #0 0x0000000003bf66c8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3bf66c8)
 #1 0x0000000003bf43cc llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3bf43cc)
 #2 0x0000000003b419c8 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
 #3 0x00007e2f27042520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #4 0x00007e2f270969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
 #5 0x00007e2f27042476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
 #6 0x00007e2f270287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
 #7 0x00007e2f2702871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
 #8 0x00007e2f27039e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
 #9 0x0000000007bb76ad clang::RequiresExpr::RequiresExpr(clang::ASTContext&, clang::SourceLocation, clang::RequiresExprBodyDecl*, clang::SourceLocation, llvm::ArrayRef<clang::ParmVarDecl*>, clang::SourceLocation, llvm::ArrayRef<clang::concepts::Requirement*>, clang::SourceLocation) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x7bb76ad)
#10 0x0000000007bb77c0 clang::RequiresExpr::Create(clang::ASTContext&, clang::SourceLocation, clang::RequiresExprBodyDecl*, clang::SourceLocation, llvm::ArrayRef<clang::ParmVarDecl*>, clang::SourceLocation, llvm::ArrayRef<clang::concepts::Requirement*>, clang::SourceLocation) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x7bb77c0)
#11 0x0000000006df9657 clang::Sema::ActOnRequiresExpr(clang::SourceLocation, clang::RequiresExprBodyDecl*, clang::SourceLocation, llvm::ArrayRef<clang::ParmVarDecl*>, clang::SourceLocation, llvm::ArrayRef<clang::concepts::Requirement*>, clang::SourceLocation) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6df9657)
#12 0x00000000067a55cd clang::Parser::ParseRequiresExpression() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x67a55cd)
#13 0x0000000006793811 clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, bool&, clang::Parser::TypeCastState, bool, bool*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6793811)
#14 0x0000000006794df7 clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, clang::Parser::TypeCastState, bool, bool*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6794df7)
#15 0x00000000067a000a clang::Parser::ParseConstraintLogicalAndExpression(bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x67a000a)
#16 0x00000000067a047d clang::Parser::ParseConstraintLogicalOrExpression(bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x67a047d)
#17 0x0000000006834fde clang::Parser::ParseTemplateDeclarationOrSpecialization(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&, clang::AccessSpecifier) (.part.0) ParseTemplate.cpp:0:0
#18 0x000000000683517a clang::Parser::ParseDeclarationStartingWithTemplate(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x683517a)
#19 0x00000000067667a3 clang::Parser::ParseDeclaration(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&, clang::ParsedAttributes&, clang::SourceLocation*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x67667a3)
#20 0x00000000067257c7 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x67257c7)
#21 0x000000000672666d clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x672666d)
#22 0x0000000006718b8a clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6718b8a)
#23 0x00000000045725c8 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x45725c8)
#24 0x000000000482d559 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x482d559)
#25 0x00000000047ac7ce clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x47ac7ce)
#26 0x000000000491335e clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x491335e)
#27 0x0000000000ce9aff cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xce9aff)
#28 0x0000000000ce17ba ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#29 0x00000000045b57c9 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
#30 0x0000000003b41e74 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3b41e74)
#31 0x00000000045b5dbf 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
#32 0x000000000457c0ad clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x457c0ad)
#33 0x000000000457d19d clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x457d19d)
#34 0x0000000004584555 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4584555)
#35 0x0000000000ce6999 clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xce6999)
#36 0x0000000000bb3494 main (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xbb3494)
#37 0x00007e2f27029d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#38 0x00007e2f27029e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#39 0x0000000000ce126e _start (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xce126e)
clang++: error: clang frontend command failed with exit code 134 (use -v to see invocation)
Compiler returned: 134
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzsWl1z2zbW_jXwDYYaEvy-8IUsWX3TphNP5LedvdKAICihoQAWAB05v34HICURtKTYu1a2O9tMbEvgwTkPnvOBQxJYKbbmlN6C-A7E8xvc6o2Qt8_sD8yjLIpvClE-3wI0BWj6uGEKaqo0wYpCpuCaciqxpiUsniGGVfvtG5WTThj4c-D3v2di27CaSni_a2ohqQThFIL4bqN1o0A4BWgB0GItykLUeiLkGqDFN4AW8peH3T-q4NffQTwHKHu9OMqH5i1uxp9wzUpIREnhV1bXkEisNlBwSGrM1xArRaVmgkMtW_4FfmV6A0Hie0qXIJwTgO4AukM-SHyDodOf-N1_0jTdiKbbpsaagnCmnxvK8ZbCR4Bm8PDt_0F438kSwZWmu0bCQogaMrVSeEtXTxCEc1jhWlEQ3g0Xclr599SBcGYRGEmrWsv2dZrPwia00XBpho2-F5asrGuAcQ0rIQKAMoByCNL-KqRSCgnCu9f-_S-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