Index: include/clang/Basic/DiagnosticSemaKinds.td =================================================================== --- include/clang/Basic/DiagnosticSemaKinds.td +++ include/clang/Basic/DiagnosticSemaKinds.td @@ -8808,6 +8808,9 @@ "vector component name '%0' is an OpenCL version 2.2 feature">, InGroup; +def err_openclcxx_placement_new : Error< + "use of placement new requires explicit declaration">; + // MIG routine annotations. def warn_mig_server_routine_does_not_return_kern_return_t : Warning< "'mig_server_routine' attribute only applies to routines that return a kern_return_t">, Index: lib/Sema/SemaExprCXX.cpp =================================================================== --- lib/Sema/SemaExprCXX.cpp +++ lib/Sema/SemaExprCXX.cpp @@ -2413,7 +2413,11 @@ } if (getLangOpts().OpenCLCPlusPlus && R.empty()) { - Diag(StartLoc, diag::err_openclcxx_not_supported) << "default new"; + if (PlaceArgs.empty()) { + Diag(StartLoc, diag::err_openclcxx_not_supported) << "default new"; + } else { + Diag(StartLoc, diag::err_openclcxx_placement_new); + } return true; } Index: test/SemaOpenCLCXX/newdelete.cl =================================================================== --- test/SemaOpenCLCXX/newdelete.cl +++ test/SemaOpenCLCXX/newdelete.cl @@ -21,7 +21,7 @@ void test_default_new_delete(void *buffer, A **pa) { A *a = new A; // expected-error {{'default new' is not supported in OpenCL C++}} delete a; // expected-error {{'default delete' is not supported in OpenCL C++}} - *pa = new (buffer) A; // expected-error {{'default new' is not supported in OpenCL C++}} + *pa = new (buffer) A; // expected-error {{use of placement new requires explicit declaration}} } // expected-note@+1 {{candidate function not viable: requires 2 arguments, but 1 was provided}}