[llvm-bugs] [Bug 26007] New: Clang-cl checks on copy-constructor on during initialization

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Jan 3 04:55:41 PST 2016


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: unassignedclangbugs at nondot.org
          Reporter: jvapen at gmail.com
                CC: llvm-bugs at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160103/1f336d32/attachment.html>


More information about the llvm-bugs mailing list