[llvm-bugs] [Bug 47852] New: Accepts-invalid with parameter pack expansion in lambda capture

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Oct 15 01:42:19 PDT 2020


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

            Bug ID: 47852
           Summary: Accepts-invalid with parameter pack expansion in
                    lambda capture
           Product: clang
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++17
          Assignee: unassignedclangbugs at nondot.org
          Reporter: sgiesecke at mozilla.com
                CC: blitzrakete at gmail.com, erik.pilkington at gmail.com,
                    llvm-bugs at lists.llvm.org, richard-llvm at metafoo.co.uk

Referring to this gcc bug report
(https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97358#c2), clang accepts this
seemingly invalid code:
```
template <typename... T> void foo (T... x)
{
}

template <typename... T> void bar (T... x)
{
  foo ([x...] { static_cast<void> (x); }...);
}

void
test ()
{
  bar ();
  bar (1);
  bar (2.0, 3LL, 4);
}
```

gcc trunk produces these errors now:
```
<source>: In lambda function:

<source>:7:17: error: parameter packs not expanded with '...':

    7 |   foo ([x...] { static_cast<void> (x); }...);

      |                 ^~~~~~~~~~~~~~~~~~~~~

<source>:7:17: note:         'x'

<source>: In function 'void bar(T ...)':

<source>:7:41: error: expansion pattern '<lambda>' contains no parameter packs

    7 |   foo ([x...] { static_cast<void> (x); }...);

      |                                         ^~~

ASM generation compiler returned: 1

<source>: In lambda function:

<source>:7:17: error: parameter packs not expanded with '...':

    7 |   foo ([x...] { static_cast<void> (x); }...);

      |                 ^~~~~~~~~~~~~~~~~~~~~

<source>:7:17: note:         'x'

<source>: In function 'void bar(T ...)':

<source>:7:41: error: expansion pattern '<lambda>' contains no parameter packs

    7 |   foo ([x...] { static_cast<void> (x); }...);

      |                                         ^~~

Execution build compiler returned: 1
```

Earlier gcc versions produced an ICE, which the mentioned bug was about.

-- 
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/20201015/de1158ee/attachment.html>


More information about the llvm-bugs mailing list