[llvm-bugs] [Bug 35984] New: Failure to capture variable from structured binding

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Jan 17 03:18:57 PST 2018


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

            Bug ID: 35984
           Summary: Failure to capture variable from structured binding
           Product: new-bugs
           Version: 5.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: svalorzen at gmail.com
                CC: llvm-bugs at lists.llvm.org

```
#include <tuple>

std::tuple<int, double> a() { return std::make_tuple(0, 0.4); }

int main() {
    auto [x, y] = a();
    const auto q = [x](){ return true; };
    return 0;
}
```

This fails to compile with 

7 : <source>:7:21: error: 'x' in capture list does not name a variable
    const auto q = [x](){ return true; };

This breaks on my machine with clang++ 4.0. I have also tested this on clang++
5.0 on godbolt.org.

-- 
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/20180117/1339f8bb/attachment.html>


More information about the llvm-bugs mailing list