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

    <tr>
        <th>Summary</th>
        <td>
            Clang segfault while compiling C++20 code
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

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

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

<pre>
    When compiling the following code ([link to Godbolt](https://godbolt.org/z/f5Mffac8G)) with `-std=c++20`, a segfault occurs.
```cpp
namespace typedef wchar_t wstring
void feof()
struct struct0 {
        template <typename S> consteval struct0(S
}
template <typename...> using alias = struct0;
template auto function0(alias<>) -> string foo struct struct1 {
        function1() {
                bar foos;
                for (struct1 foo function0(fooo)
```

Backtrace:
```
Stack dump:
0.      Program arguments: /opt/compiler-explorer/clang-14.0.0/bin/clang++ -g -o /app/output.s -mllvm --x86-asm-syntax=intel -S --gcc-toolchain=/opt/compiler-explorer/gcc-11.2.0 -fcolor-diagnostics -fno-crash-diagnostics -std=c++20 <source>
1.      <eof> parser at end of file
2.      <source>:7:48: parsing struct/union/class body 'struct1'
3.      <source>:8:14: parsing function body 'struct1::function1'
 #0 0x000055ba3377de8f PrintStackTraceSignalHandler(void*) Signals.cpp:0:0
 #1 0x000055ba3377bd60 llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-14.0.0/bin/clang+++0x357bd60)
 #2 0x000055ba336b6b78 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
 #3 0x00007fced5cf03c0 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x143c0)
 #4 0x000055ba362223f8 clang::StmtVisitorBase<llvm::make_const_ptr, (anonymous namespace)::RecordExprEvaluator, bool>::Visit(clang::Stmt const*) ExprConstant.cpp:0:0
 #5 0x000055ba36223be0 clang::StmtVisitorBase<llvm::make_const_ptr, (anonymous namespace)::RecordExprEvaluator, bool>::Visit(clang::Stmt const*) ExprConstant.cpp:0:0
 #6 0x000055ba361fd90c EvaluateInPlace(clang::APValue&, (anonymous namespace)::EvalInfo&, (anonymous namespace)::LValue const&, clang::Expr const*, bool) ExprConstant.cpp:0:0
 #7 0x000055ba3620547c clang::Expr::EvaluateAsConstantExpr(clang::Expr::EvalResult&, clang::ASTContext const&, clang::Expr::ConstantExprKind) const (/opt/compiler-explorer/clang-14.0.0/bin/clang+++0x600547c)
 #8 0x000055ba359785a9 clang::Sema::PopExpressionEvaluationContext() (/opt/compiler-explorer/clang-14.0.0/bin/clang+++0x57785a9)
 #9 0x000055ba35827ff0 clang::Sema::ActOnFinishFunctionBody(clang::Decl*, clang::Stmt*, bool) (/opt/compiler-explorer/clang-14.0.0/bin/clang+++0x5627ff0)
#10 0x000055ba3564f4f7 clang::Parser::ParseFunctionStatementBody(clang::Decl*, clang::Parser::ParseScope&) (/opt/compiler-explorer/clang-14.0.0/bin/clang+++0x544f4f7)
#11 0x000055ba355ab143 clang::Parser::ParseLexedMethodDef(clang::Parser::LexedMethod&) (/opt/compiler-explorer/clang-14.0.0/bin/clang+++0x53ab143)
#12 0x000055ba355aae15 clang::Parser::ParseLexedMethodDefs(clang::Parser::ParsingClass&) (/opt/compiler-explorer/clang-14.0.0/bin/clang+++0x53aae15)
#13 0x000055ba355e6a10 clang::Parser::ParseCXXMemberSpecification(clang::SourceLocation, clang::SourceLocation, clang::ParsedAttributesWithRange&, unsigned int, clang::Decl*) (/opt/compiler-explorer/clang-14.0.0/bin/clang+++0x53e6a10)
#14 0x000055ba355e9060 clang::Parser::ParseClassSpecifier(clang::tok::TokenKind, clang::SourceLocation, clang::DeclSpec&, clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier, bool, clang::Parser::DeclSpecContext, clang::ParsedAttributesWithRange&) (/opt/compiler-explorer/clang-14.0.0/bin/clang+++0x53e9060)
#15 0x000055ba355ca00d clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&, clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier, clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*) (/opt/compiler-explorer/clang-14.0.0/bin/clang+++0x53ca00d)
#16 0x000055ba3559f43f clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributesWithRange&, clang::ParsingDeclSpec&, clang::AccessSpecifier) (/opt/compiler-explorer/clang-14.0.0/bin/clang+++0x539f43f)
#17 0x000055ba3559fcc1 clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributesWithRange&, clang::ParsingDeclSpec*, clang::AccessSpecifier) (.part.280) Parser.cpp:0:0
#18 0x000055ba355a5be9 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributesWithRange&, clang::ParsingDeclSpec*) (/opt/compiler-explorer/clang-14.0.0/bin/clang+++0x53a5be9)
#19 0x000055ba355a7009 clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, bool) (/opt/compiler-explorer/clang-14.0.0/bin/clang+++0x53a7009)
#20 0x000055ba3559a869 clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-14.0.0/bin/clang+++0x539a869)
#21 0x000055ba34705b02 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-14.0.0/bin/clang+++0x4505b02)
#22 0x000055ba34101161 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-14.0.0/bin/clang+++0x3f01161)
#23 0x000055ba3409c2f2 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-14.0.0/bin/clang+++0x3e9c2f2)
#24 0x000055ba341cc853 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-14.0.0/bin/clang+++0x3fcc853)
#25 0x000055ba3139b1d4 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-14.0.0/bin/clang+++0x119b1d4)
#26 0x000055ba3139718d ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&) driver.cpp:0:0
#27 0x000055ba33f375f5 void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, bool*) const::'lambda'()>(long) Job.cpp:0:0
#28 0x000055ba336b7163 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-14.0.0/bin/clang+++0x34b7163)
#29 0x000055ba33f396c8 clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, bool*) const (/opt/compiler-explorer/clang-14.0.0/bin/clang+++0x3d396c8)
#30 0x000055ba33f0cb1a clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&) const (/opt/compiler-explorer/clang-14.0.0/bin/clang+++0x3d0cb1a)
#31 0x000055ba33f0d65f clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&) const (/opt/compiler-explorer/clang-14.0.0/bin/clang+++0x3d0d65f)
#32 0x000055ba33f16005 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&) (/opt/compiler-explorer/clang-14.0.0/bin/clang+++0x3d16005)
#33 0x000055ba312a80b2 main (/opt/compiler-explorer/clang-14.0.0/bin/clang+++0x10a80b2)
#34 0x00007fced579e0b3 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x240b3)
#35 0x000055ba31396d0a _start (/opt/compiler-explorer/clang-14.0.0/bin/clang+++0x1196d0a)
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzlWktz2zgS_jXyBSUV34-DD7IcZ7ObVFyWKzM3FQgCEtcUwSVAW55fvw2AkgjqMc4OZw6zLtqmALC7v68bj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