<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - crash on lambda of unevaluated context as template type parameter"
   href="https://bugs.llvm.org/show_bug.cgi?id=52072">52072</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>crash on lambda of unevaluated context as template type parameter
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>C++2a
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>nickhuang99@hotmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>blitzrakete@gmail.com, erik.pilkington@gmail.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>GCC supports following code by rebuilding function type:

template <class T> void spam(decltype([]{}) (*s)[sizeof(T)] = nullptr)
{ }

void foo()
{
  spam<int>();
}

clang-13 crashes:

PLEASE submit a bug report to <a href="https://bugs.llvm.org/">https://bugs.llvm.org/</a> and include the crash
backtrace, preprocessed source, and associated run script.
Stack dump:
0.      Program arguments: /opt/compiler-explorer/clang-trunk/bin/clang++ -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.      <eof> parser at end of file
2.      <source>:4:6: LLVM IR generation of declaration 'foo'
3.      <source>:4:6: Generating code for declaration 'foo'
 #0 0x0000556ede5a211f PrintStackTraceSignalHandler(void*) Signals.cpp:0:0
 #1 0x0000556ede59ffe0 llvm::sys::CleanupOnSignal(unsigned long)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x359ffe0)
 #2 0x0000556ede4efe48 CrashRecoverySignalHandler(int)
CrashRecoveryContext.cpp:0:0
 #3 0x00007f3c9cef33c0 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x153c0)
 #4 0x0000556ede9dda66
clang::CodeGen::CodeGenTypes::ConvertTypeForMem(clang::QualType, bool)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x39dda66)
 #5 0x0000556ede9dcd73
clang::CodeGen::CodeGenTypes::ConvertType(clang::QualType)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x39dcd73)
 #6 0x0000556ede9dda04
clang::CodeGen::CodeGenTypes::ConvertTypeForMem(clang::QualType, bool)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x39dda04)
 #7 0x0000556ede9dca88
clang::CodeGen::CodeGenTypes::ConvertType(clang::QualType)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x39dca88)
 #8 0x0000556edea44821 (anonymous
namespace)::X86_64ABIInfo::classifyArgumentType(clang::QualType, unsigned int,
unsigned int&, unsigned int&, bool) const TargetInfo.cpp:0:0
 #9 0x0000556edea45da0 (anonymous
namespace)::X86_64ABIInfo::computeInfo(clang::CodeGen::CGFunctionInfo&) const
TargetInfo.cpp:0:0
#10 0x0000556edeb5324a
clang::CodeGen::CodeGenTypes::arrangeLLVMFunctionInfo(clang::CanQual<clang::Type>,
bool, bool, llvm::ArrayRef<clang::CanQual<clang::Type> >,
clang::FunctionType::ExtInfo,
llvm::ArrayRef<clang::FunctionType::ExtParameterInfo>,
clang::CodeGen::RequiredArgs)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x3b5324a)
#11 0x0000556edeb55a26
clang::CodeGen::CodeGenTypes::arrangeFreeFunctionType(clang::CanQual<clang::FunctionProtoType>)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x3b55a26)
#12 0x0000556ede9dbc25
clang::CodeGen::CodeGenTypes::ConvertFunctionTypeInternal(clang::QualType)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x39dbc25)
#13 0x0000556ede9dce2b
clang::CodeGen::CodeGenTypes::ConvertType(clang::QualType)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x39dce2b)
#14 0x0000556ede9a6073
clang::CodeGen::CodeGenModule::GetAddrOfFunction(clang::GlobalDecl,
llvm::Type*, bool, bool, clang::CodeGen::ForDefinition_t)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x39a6073)
#15 0x0000556edebaa8f6 EmitFunctionDeclPointer(clang::CodeGen::CodeGenModule&,
clang::GlobalDecl) CGExpr.cpp:0:0
#16 0x0000556edebaaba0 EmitDirectCallee(clang::CodeGen::CodeGenFunction&,
clang::GlobalDecl) (.isra.1047) CGExpr.cpp:0:0
#17 0x0000556edebc7ea1 clang::CodeGen::CodeGenFunction::EmitCallee(clang::Expr
const*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3bc7ea1)
#18 0x0000556edebc7ed3 clang::CodeGen::CodeGenFunction::EmitCallee(clang::Expr
const*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3bc7ed3)
#19 0x0000556edebc8081
clang::CodeGen::CodeGenFunction::EmitCallExpr(clang::CallExpr const*,
clang::CodeGen::ReturnValueSlot)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x3bc8081)
#20 0x0000556edec03f6b (anonymous
namespace)::ScalarExprEmitter::VisitCallExpr(clang::CallExpr const*)
CGExprScalar.cpp:0:0
#21 0x0000556edebf8693 (anonymous
namespace)::ScalarExprEmitter::Visit(clang::Expr*) CGExprScalar.cpp:0:0
#22 0x0000556edebface3
clang::CodeGen::CodeGenFunction::EmitScalarExpr(clang::Expr const*, bool)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x3bface3)
#23 0x0000556edebafb47 clang::CodeGen::CodeGenFunction::EmitAnyExpr(clang::Expr
const*, clang::CodeGen::AggValueSlot, bool)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x3bafb47)
#24 0x0000556edebc6c6e
clang::CodeGen::CodeGenFunction::EmitIgnoredExpr(clang::Expr const*)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x3bc6c6e)
#25 0x0000556ede90508c clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt
const*, llvm::ArrayRef<clang::Attr const*>)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x390508c)
#26 0x0000556ede90a5ac
clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt
const&, bool, clang::CodeGen::AggValueSlot)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x390a5ac)
#27 0x0000556ede958169
clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::Stmt const*)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x3958169)
#28 0x0000556ede960983
clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl,
llvm::Function*, clang::CodeGen::CGFunctionInfo const&)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x3960983)
#29 0x0000556ede9a627e
clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl,
llvm::GlobalValue*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x39a627e)
#30 0x0000556ede9a30c5
clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl,
llvm::GlobalValue*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x39a30c5)
#31 0x0000556ede9a37cb
clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x39a37cb)
#32 0x0000556ede9a93e1
clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*) (.part.5289)
CodeGenModule.cpp:0:0
#33 0x0000556edf5415b1 (anonymous
namespace)::CodeGeneratorImpl::HandleTopLevelDecl(clang::DeclGroupRef)
ModuleBuilder.cpp:0:0
#34 0x0000556edf534802
clang::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x4534802)
#35 0x0000556ee0378cc4 clang::ParseAST(clang::Sema&, bool, bool)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x5378cc4)
#36 0x0000556edf53f5e2 clang::CodeGenAction::ExecuteAction()
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x453f5e2)
#37 0x0000556edeed5df1 clang::FrontendAction::Execute()
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x3ed5df1)
#38 0x0000556edee729c2
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x3e729c2)
#39 0x0000556edefa3413
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x3fa3413)
#40 0x0000556edc2d327c cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x12d327c)
#41 0x0000556edc2cf2ed ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&)
driver.cpp:0:0
#42 0x0000556eded17805 void llvm::function_ref<void
()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef>
<span class="quote">>, std::__cxx11::basic_string<char, std::char_traits<char>,</span >
std::allocator<char> >*, bool*) const::'lambda'()>(long) Job.cpp:0:0
#43 0x0000556ede4f0433
llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x34f0433)
#44 0x0000556eded198be
clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef>
<span class="quote">>, std::__cxx11::basic_string<char, std::char_traits<char>,</span >
std::allocator<char> >*, bool*) const
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x3d198be)
#45 0x0000556edecef12a
clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&,
clang::driver::Command const*&) const
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x3cef12a)
#46 0x0000556edecefc6f
clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&,
llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&) const
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x3cefc6f)
#47 0x0000556edecf90a5
clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&,
llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x3cf90a5)
#48 0x0000556edc1e30ae main
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x11e30ae)
#49 0x00007f3c9c9a30b3 __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x270b3)
#50 0x0000556edc2cee6a _start
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x12cee6a)
clang-14: error: clang frontend command failed with exit code 139 (use -v to
see invocation)
Compiler returned: 139</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>