[llvm-bugs] [Bug 50246] New: ICE explicit calling a caputered lambda expression with a paramater pack

via llvm-bugs llvm-bugs at lists.llvm.org
Thu May 6 10:30:15 PDT 2021


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

            Bug ID: 50246
           Summary: ICE explicit calling a caputered lambda expression
                    with a paramater pack
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: Peter.Georg at physik.uni-regensburg.de
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org,
                    neeilans at live.com, richard-llvm at metafoo.co.uk

Created attachment 24835
  --> https://bugs.llvm.org/attachment.cgi?id=24835&action=edit
Crash backtrace

See reduced test-case on Compiler Explorer: https://godbolt.org/z/G4qT3sEf9

According to Compiler Explorer all clang versions (supporting the required
C++11/14 features) are affected by this bug.

clang frontend crashes when explicitly calling a captured lambda expression's
operator() using a parameter pack as arguments. The issue has been observed in
a larger code base in a more complex scenario using the familiar template
syntax for generic lambdas introduced in C++20.

Luckily I've been able to reduce the code to just a few meaning-less lines of
code still showing the same compiler error. While I have been able to rewrite
it using only C++11, the attached reduced code is written using C++14 features.
It just seems easier to understand and removes probably unrelated code.

Code to reproduce:

int main() {
  {
    auto const f = [](auto...) {};
    [f](auto const... ops) { f.operator()(ops...); }();
  }
}

My tests have shown that in line 4 of the code to reproduce the bug will only
show if all following three conditions are met:
1. The lambda expression f is captured. I.e. not defined within the other
unnamed lambda expression.
2. The lambda expression f is called via explicitly specifying .operator()
3. A parameter pack expansion is used as the arguments for calling the lambda
expression f. The size of the parameter pack does not matter, may be empty.

Attachements:
Crash backtrace, preprocessed source(s), and run script produced on local
machine with clang 11.

-- 
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/20210506/c93a435e/attachment-0001.html>


More information about the llvm-bugs mailing list