[llvm-bugs] [Bug 43293] New: C++17 Lambda-expression with implicit capture fails to compile.

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Sep 12 05:56:10 PDT 2019


            Bug ID: 43293
           Summary: C++17 Lambda-expression with implicit capture fails to
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++17
          Assignee: unassignedclangbugs at nondot.org
          Reporter: chackz0x12 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

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

Good day,

I believe I may have discovered a bug in TOT clang. When compiling the attached
reproducible with the following command:

clang ./repro.cpp -g -O2 -std=gnu++17

I get the following error message:

./repro.cpp:9:19: error: variable 'myFoo' cannot be implicitly captured in a
lambda with no capture-default specified

I've checked cpp reference and done a, albeit shallow, dive into the spec and I
can't find any contrary definitions that state the repro shouldn't compile.

The test compiles fine with GCC 9.2 on godbolt and also with clang 8.0.

The change in behaviour was introduced in r363086,
715f7a1bd058c64a39cc4773114dfb46ae8cc8a3 (monorepo).

can anyone confirm the following.

1. the test is either well formed or not.
2. is this a genuine bug.

Thank you for your valuable time.

Tom W

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/20190912/1ccc5108/attachment.html>

More information about the llvm-bugs mailing list