<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - Clang-cl checks on copy-constructor on during initialization"
   href="https://llvm.org/bugs/show_bug.cgi?id=26007">26007</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Clang-cl checks on copy-constructor on during initialization
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Windows NT
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>-New Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>jvapen@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>