<html>
    <head>
      <base href="http://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 --- - constexpr does not work with placement new"
   href="http://llvm.org/bugs/show_bug.cgi?id=19685">19685</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>constexpr does not work with placement new
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>3.4
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>Linux
          </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>C++11
          </td>
        </tr>

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

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

        <tr>
          <th>CC</th>
          <td>dgregor@apple.com, llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>#include <stddef.h>
    constexpr void* operator new(size_t, int*) noexcept {
        return nullptr;
    }

    int main() {
        int* p = new (nullptr) int;            // This is Okay
        constexpr int* q = new (nullptr) int;  // gcc works, clang compile
error
        return *(p = q);
    }

This code compiles with gcc 4.6, 4.7, 4.8, 4.9 and generates correct assembly
(with command line option "-std=c++0x")

It doesn't compile with clang 3.0, 3.2, 3.3, 3.4
(tried "-std=c++1y", "-std=c++11" and "-std=c++0x", none of them works)

Tested by Compiler Explorer: <a href="http://goo.gl/bmGtbR">http://goo.gl/bmGtbR</a></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>