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

            Bug ID: 26007
           Summary: Clang-cl checks on copy-constructor on during
                    initialization
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangb...@nondot.org
          Reporter: jva...@gmail.com
                CC: llvm-bugs@lists.llvm.org
    Classification: Unclassified

Hi,

I'm trying to get some existing MSVC code compiled with clang-cl.
Apparently one of the 'features' of MSVC is that it optimizes initialization
assignment, without checking copy constructor...

Clang correctly checks on this, though clang-cl does this too, which is
unfortunate for existing MSVC code bases.

Following code compiles with MSVC2013 and MSVC2015 and fails with both clang-cl
as clang+c2 (provided by MS)


----------------------------------------
Code
----------------------------------------

#include <atomic>

int main()
{
    std::atomic<bool> b = true;
    return static_cast<int>(b.load());
}

----------------------------------------
Generated error
----------------------------------------
1>MoveSemantics.cpp(10,22): error : copying variable of type
'std::atomic<bool>' invokes deleted constructor
1>     std::atomic<bool> b = true;
1>                       ^   ~~~~
1>  C:\Program Files (x86)\Microsoft Visual Studio
14.0\VC\include\xxatomic(188,2) :  note: 'atomic' has been explicitly marked
deleted here
1>          atomic(const atomic&) = delete;
1>          ^
1>  1 error generated.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to