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

            Bug ID: 23281
           Summary: clang allows invalid code with lambda expression
                    move-assignment
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]
    Classification: Unclassified

The following code compiles in clang++ 3.7 but is rejected by gcc and intel
compiler.

#include <utility>                                                              
int main() {                                                                    
  auto f = [](int x) { return 7*x; };                                           
  using T = decltype(f);                                                        
  T h(f);                                                                       
  h = std::move(f);                                                             
  return 0;                                                                     
} 

Also, the standard seems to disallow it:

http://eel.is/c++draft/expr.prim.lambda#20 – lambdas have deleted copy
assignment. Also, http://eel.is/c++draft/class.copy#20 says that means that
deleted copy assignment means there will be no move assignment.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to