[LLVMbugs] [Bug 19339] New: generalized lambda capture in uniform initialization failed to compile

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Apr 4 02:30:19 PDT 2014


http://llvm.org/bugs/show_bug.cgi?id=19339

            Bug ID: 19339
           Summary: generalized lambda capture in uniform initialization
                    failed to compile
           Product: clang
           Version: trunk
          Hardware: PC
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++1y
          Assignee: unassignedclangbugs at nondot.org
          Reporter: xlchen1291 at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

#include <utility>
#include <vector>

struct Foo {
    template <class T>
    Foo(T) {}
};

void bar()
{
    std::vector<int> vec;
    auto func = [vec{std::move(vec)}] () { };
    Foo f1 { func};  // compile
    Foo f2 { [vec] () { } }; // compile
    Foo f3 { [vec{std::move(vec)}] () {} }; // failed to compile
}

int main() {

}

----------------------------

clang++ -std=c++1y -O2 -Wall -pedantic -pthread main.cpp
main.cpp:15:18: error: expected ']'
    Foo f3 { [vec{std::move(vec)}] () {} }; // failed to compile
                 ^
main.cpp:15:14: note: to match this '['
    Foo f3 { [vec{std::move(vec)}] () {} }; // failed to compile
             ^
main.cpp:15:36: warning: use of GNU 'missing =' extension in designator
[-Wgnu-designator]
    Foo f3 { [vec{std::move(vec)}] () {} }; // failed to compile
                                   ^
                                   = 
main.cpp:15:37: error: expected expression
    Foo f3 { [vec{std::move(vec)}] () {} }; // failed to compile
                                    ^
main.cpp:15:15: error: integral constant expression must have integral or
unscoped enumeration type, not 'std::vector<int>'
    Foo f3 { [vec{std::move(vec)}] () {} }; // failed to compile
              ^~~
1 warning and 3 errors generated.


---------------

clang version 3.5 (trunk 198621)

-- 
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/20140404/626db43d/attachment.html>


More information about the llvm-bugs mailing list