http://llvm.org/bugs/show_bug.cgi?id=19685

            Bug ID: 19685
           Summary: constexpr does not work with placement new
           Product: clang
           Version: 3.4
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]
    Classification: Unclassified

#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: http://goo.gl/bmGtbR

-- 
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