[llvm-bugs] [Bug 49881] New: Explicit call of template lambda operator()

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Apr 7 05:35:15 PDT 2021


https://bugs.llvm.org/show_bug.cgi?id=49881

            Bug ID: 49881
           Summary: Explicit call of template lambda operator()
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++2a
          Assignee: unassignedclangbugs at nondot.org
          Reporter: pro.guillaume.dua at gmail.com
                CC: blitzrakete at gmail.com, erik.pilkington at gmail.com,
                    llvm-bugs at lists.llvm.org, richard-llvm at metafoo.co.uk

Clang frontend ICE
See example on godbolt : https://godbolt.org/z/4ne8e758c

```cpp
#include <tuple>

int main()
{
    // KO, explicit template parameter

    const auto lambda_1 = []<typename T>(){};

    [&lambda_1]<typename ... Ts>(std::tuple<Ts...>){
        ((lambda_1.template operator()<Ts>()), ...);
    }(std::tuple<int>{});

    // OK, template deduced using parameter

    const auto lambda_2 = []<typename T>(T){};

    [&lambda_2]<typename ... Ts>(std::tuple<Ts...>){
        ((lambda_2(Ts{})), ...);
    }(std::tuple<int>{});
}
```

```log
PLEASE submit a bug report to https://bugs.llvm.org/ 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.      <source>:11:24: current parser token ')'
2.      <source>:4:1: parsing function body 'main'
3.      <source>:4:1: in compound statement ('{}')
4.      <source>:9:5: instantiating function definition 'main()::(anonymous
class)::operator()<int>'
5.      <source>:7:27: instantiating class definition ''
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH
or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
/opt/compiler-explorer/clang-trunk/bin/clang++(_ZN4llvm3sys15PrintStackTraceERNS_11raw_ostreamEi+0x2c)[0x55846bd2aa9c]
/opt/compiler-explorer/clang-trunk/bin/clang++(_ZN4llvm3sys17RunSignalHandlersEv+0x34)[0x55846bd28a24]
/opt/compiler-explorer/clang-trunk/bin/clang++(_ZN4llvm3sys15CleanupOnSignalEm+0xb5)[0x55846bd28ca5]
/opt/compiler-explorer/clang-trunk/bin/clang++(+0x30bbb28)[0x55846bc8cb28]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x153c0)[0x7f32b51c93c0]
/opt/compiler-explorer/clang-trunk/bin/clang++(_ZN5clang4Sema21SubstFunctionDeclTypeEPNS_14TypeSourceInfoERKNS_30MultiLevelTemplateArgumentListENS_14SourceLocationENS_15DeclarationNameEPNS_13CXXRecordDeclENS_10QualifiersE+0x1e)[0x55846e17f4de]
/opt/compiler-explorer/clang-trunk/bin/clang++(_ZN5clang24TemplateDeclInstantiator17SubstFunctionTypeEPNS_12FunctionDeclERN4llvm15SmallVectorImplIPNS_11ParmVarDeclEEE+0xe5)[0x55846e18feb5]
/opt/compiler-explorer/clang-trunk/bin/clang++(_ZN5clang24TemplateDeclInstantiator18VisitCXXMethodDeclEPNS_13CXXMethodDeclEPNS_21TemplateParameterListEN4llvm8OptionalIPKNS_27ASTTemplateArgumentListInfoEEENS0_11RewriteKindE+0x191)[0x55846e1a5381]
/opt/compiler-explorer/clang-trunk/bin/clang++(_ZN5clang4Sema16InstantiateClassENS_14SourceLocationEPNS_13CXXRecordDeclES3_RKNS_30MultiLevelTemplateArgumentListENS_26TemplateSpecializationKindEb+0x6ef)[0x55846e17457f]
/opt/compiler-explorer/clang-trunk/bin/clang++(_ZN5clang24TemplateDeclInstantiator18VisitCXXRecordDeclEPNS_13CXXRecordDeclE+0x410)[0x55846e1a5110]
/opt/compiler-explorer/clang-trunk/bin/clang++(+0x55d5ef4)[0x55846e1a6ef4]
/opt/compiler-explorer/clang-trunk/bin/clang++(_ZN5clang4Sema27runWithSufficientStackSpaceENS_14SourceLocationEN4llvm12function_refIFvvEEE+0x3f)[0x55846daba89f]
/opt/compiler-explorer/clang-trunk/bin/clang++(_ZN5clang4Sema9SubstDeclEPNS_4DeclEPNS_11DeclContextERKNS_30MultiLevelTemplateArgumentListE+0xd3)[0x55846e18f9a3]
/opt/compiler-explorer/clang-trunk/bin/clang++(_ZN5clang4Sema20FindInstantiatedDeclENS_14SourceLocationEPNS_9NamedDeclERKNS_30MultiLevelTemplateArgumentListEb+0x65f)[0x55846e1992ff]
/opt/compiler-explorer/clang-trunk/bin/clang++(+0x5581fcb)[0x55846e152fcb]
/opt/compiler-explorer/clang-trunk/bin/clang++(+0x55a63b4)[0x55846e1773b4]
/opt/compiler-explorer/clang-trunk/bin/clang++(+0x558f391)[0x55846e160391]
/opt/compiler-explorer/clang-trunk/bin/clang++(+0x5596384)[0x55846e167384]
/opt/compiler-explorer/clang-trunk/bin/clang++(+0x558f0cd)[0x55846e1600cd]
/opt/compiler-explorer/clang-trunk/bin/clang++(+0x5598735)[0x55846e169735]
/opt/compiler-explorer/clang-trunk/bin/clang++(+0x558f3a5)[0x55846e1603a5]
/opt/compiler-explorer/clang-trunk/bin/clang++(+0x559597f)[0x55846e16697f]
/opt/compiler-explorer/clang-trunk/bin/clang++(+0x558efc3)[0x55846e15ffc3]
/opt/compiler-explorer/clang-trunk/bin/clang++(+0x55b5ca0)[0x55846e186ca0]
/opt/compiler-explorer/clang-trunk/bin/clang++(+0x55badad)[0x55846e18bdad]
/opt/compiler-explorer/clang-trunk/bin/clang++(_ZN5clang4Sema9SubstStmtEPNS_4StmtERKNS_30MultiLevelTemplateArgumentListE+0x5a)[0x55846e18bcaa]
/opt/compiler-explorer/clang-trunk/bin/clang++(_ZN5clang4Sema29InstantiateFunctionDefinitionENS_14SourceLocationEPNS_12FunctionDeclEbbb+0x914)[0x55846e19ed24]
/opt/compiler-explorer/clang-trunk/bin/clang++(_ZN5clang4Sema27runWithSufficientStackSpaceENS_14SourceLocationEN4llvm12function_refIFvvEEE+0x3f)[0x55846daba89f]
/opt/compiler-explorer/clang-trunk/bin/clang++(_ZN5clang4Sema16DeduceReturnTypeEPNS_12FunctionDeclENS_14SourceLocationEb+0x9d)[0x55846e0fe64d]
/opt/compiler-explorer/clang-trunk/bin/clang++(_ZN5clang4Sema17DiagnoseUseOfDeclEPNS_9NamedDeclEN4llvm8ArrayRefINS_14SourceLocationEEEPKNS_17ObjCInterfaceDeclEbbPS7_+0x119f)[0x55846dd56a9f]
/opt/compiler-explorer/clang-trunk/bin/clang++(+0x540dacf)[0x55846dfdeacf]
/opt/compiler-explorer/clang-trunk/bin/clang++(_ZN5clang4Sema28BuildCallToObjectOfClassTypeEPNS_5ScopeEPNS_4ExprENS_14SourceLocationEN4llvm15MutableArrayRefIS4_EES5_+0x76f)[0x55846e0164bf]
/opt/compiler-explorer/clang-trunk/bin/clang++(_ZN5clang4Sema13BuildCallExprEPNS_5ScopeEPNS_4ExprENS_14SourceLocationEN4llvm15MutableArrayRefIS4_EES5_S4_bb+0xc72)[0x55846dd8d5e2]
/opt/compiler-explorer/clang-trunk/bin/clang++(_ZN5clang4Sema13ActOnCallExprEPNS_5ScopeEPNS_4ExprENS_14SourceLocationEN4llvm15MutableArrayRefIS4_EES5_S4_+0x54)[0x55846dd8e1b4]
/opt/compiler-explorer/clang-trunk/bin/clang++(_ZN5clang6Parser28ParsePostfixExpressionSuffixENS_12ActionResultIPNS_4ExprELb1EEE+0xdd8)[0x55846da05348]
/opt/compiler-explorer/clang-trunk/bin/clang++(_ZN5clang6Parser19ParseCastExpressionENS0_13CastParseKindEbRbNS0_13TypeCastStateEbPb+0x2c7)[0x55846d9ffaa7]
/opt/compiler-explorer/clang-trunk/bin/clang++(_ZN5clang6Parser19ParseCastExpressionENS0_13CastParseKindEbNS0_13TypeCastStateEbPb+0x36)[0x55846da024b6]
/opt/compiler-explorer/clang-trunk/bin/clang++(_ZN5clang6Parser25ParseAssignmentExpressionENS0_13TypeCastStateE+0x38)[0x55846da03688]
/opt/compiler-explorer/clang-trunk/bin/clang++(_ZN5clang6Parser15ParseExpressionENS0_13TypeCastStateE+0x9)[0x55846da04339]
/opt/compiler-explorer/clang-trunk/bin/clang++(_ZN5clang6Parser18ParseExprStatementENS0_17ParsedStmtContextE+0x4d)[0x55846da63a1d]
/opt/compiler-explorer/clang-trunk/bin/clang++(_ZN5clang6Parser42ParseStatementOrDeclarationAfterAttributesERN4llvm11SmallVectorIPNS_4StmtELj32EEENS0_17ParsedStmtContextEPNS_14SourceLocationERNS_25ParsedAttributesWithRangeE+0x80b)[0x55846da5bb3b]
/opt/compiler-explorer/clang-trunk/bin/clang++(_ZN5clang6Parser27ParseStatementOrDeclarationERN4llvm11SmallVectorIPNS_4StmtELj32EEENS0_17ParsedStmtContextEPNS_14SourceLocationE+0x9d)[0x55846da5bf4d]
/opt/compiler-explorer/clang-trunk/bin/clang++(_ZN5clang6Parser26ParseCompoundStatementBodyEb+0x731)[0x55846da5ca61]
/opt/compiler-explorer/clang-trunk/bin/clang++(_ZN5clang6Parser26ParseFunctionStatementBodyEPNS_4DeclERNS0_10ParseScopeE+0xd3)[0x55846da60253]
/opt/compiler-explorer/clang-trunk/bin/clang++(_ZN5clang6Parser23ParseFunctionDefinitionERNS_17ParsingDeclaratorERKNS0_18ParsedTemplateInfoEPNS0_18LateParsedAttrListE+0x477)[0x55846d9b7507]
/opt/compiler-explorer/clang-trunk/bin/clang++(_ZN5clang6Parser14ParseDeclGroupERNS_15ParsingDeclSpecENS_17DeclaratorContextEPNS_14SourceLocationEPNS0_12ForRangeInitE+0x750)[0x55846d9dfc40]
/opt/compiler-explorer/clang-trunk/bin/clang++(_ZN5clang6Parser30ParseDeclOrFunctionDefInternalERNS_25ParsedAttributesWithRangeERNS_15ParsingDeclSpecENS_15AccessSpecifierE+0x211)[0x55846d9b2d51]
/opt/compiler-explorer/clang-trunk/bin/clang++(+0x4de2481)[0x55846d9b3481]
/opt/compiler-explorer/clang-trunk/bin/clang++(_ZN5clang6Parser24ParseExternalDeclarationERNS_25ParsedAttributesWithRangeEPNS_15ParsingDeclSpecE+0x179)[0x55846d9b9169]
/opt/compiler-explorer/clang-trunk/bin/clang++(_ZN5clang6Parser17ParseTopLevelDeclERNS_9OpaquePtrINS_12DeclGroupRefEEEb+0x151)[0x55846d9ba6f1]
/opt/compiler-explorer/clang-trunk/bin/clang++(_ZN5clang8ParseASTERNS_4SemaEbb+0x229)[0x55846d9ade69]
/opt/compiler-explorer/clang-trunk/bin/clang++(_ZN5clang13CodeGenAction13ExecuteActionEv+0x32)[0x55846cbcb162]
/opt/compiler-explorer/clang-trunk/bin/clang++(_ZN5clang14FrontendAction7ExecuteEv+0xc1)[0x55846c5b7f71]
/opt/compiler-explorer/clang-trunk/bin/clang++(_ZN5clang16CompilerInstance13ExecuteActionERNS_14FrontendActionE+0x153)[0x55846c5572a3]
/opt/compiler-explorer/clang-trunk/bin/clang++(_ZN5clang25ExecuteCompilerInvocationEPNS_16CompilerInstanceE+0x813)[0x55846c680513]
/opt/compiler-explorer/clang-trunk/bin/clang++(_Z8cc1_mainN4llvm8ArrayRefIPKcEES2_Pv+0x118c)[0x558469c6096c]
/opt/compiler-explorer/clang-trunk/bin/clang++(+0x108ba8d)[0x558469c5ca8d]
/opt/compiler-explorer/clang-trunk/bin/clang++(+0x383ba25)[0x55846c40ca25]
/opt/compiler-explorer/clang-trunk/bin/clang++(_ZN4llvm20CrashRecoveryContext9RunSafelyENS_12function_refIFvvEEE+0x23)[0x55846bc8cc03]
/opt/compiler-explorer/clang-trunk/bin/clang++(+0x383c358)[0x55846c40d358]
/opt/compiler-explorer/clang-trunk/bin/clang++(_ZNK5clang6driver11Compilation14ExecuteCommandERKNS0_7CommandERPS3_+0x9a)[0x55846c3e549a]
/opt/compiler-explorer/clang-trunk/bin/clang++(_ZNK5clang6driver11Compilation11ExecuteJobsERKNS0_7JobListERN4llvm15SmallVectorImplISt4pairIiPKNS0_7CommandEEEE+0x29f)[0x55846c3e5fef]
/opt/compiler-explorer/clang-trunk/bin/clang++(_ZN5clang6driver6Driver18ExecuteCompilationERNS0_11CompilationERN4llvm15SmallVectorImplISt4pairIiPKNS0_7CommandEEEE+0xa5)[0x55846c3eef05]
/opt/compiler-explorer/clang-trunk/bin/clang++(main+0x1814)[0x558469b78884]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf3)[0x7f32b4c7a0b3]
/opt/compiler-explorer/clang-trunk/bin/clang++(_start+0x2a)[0x558469c5c5ea]
clang-13: error: clang frontend command failed with exit code 139 (use -v to
see invocation)
Compiler returned: 139
```

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210407/273e04b9/attachment.html>


More information about the llvm-bugs mailing list