summaryrefslogtreecommitdiff
path: root/lib/Sema/SemaExprCXX.cpp
diff options
context:
space:
mode:
authorSven van Haastregt <sven.vanhaastregt@arm.com>2019-06-26 13:31:24 +0000
committerSven van Haastregt <sven.vanhaastregt@arm.com>2019-06-26 13:31:24 +0000
commitf269c05476a4fcb055be233e013966ad0b25391f (patch)
tree1c528fe705fe509200e9075284c5aef0f66a8eff /lib/Sema/SemaExprCXX.cpp
parentbe6c4bde2d2a25fbc78c6217463537a2c47ee33b (diff)
downloadclang-f269c05476a4fcb055be233e013966ad0b25391f.tar.gz
[OpenCL] Improve diagnostic for placement new
Without an explicit declaration for placement new, clang would reject uses of placement new with "'default new' is not supported in OpenCL C++". This may mislead users into thinking that placement new is not supported, see e.g. PR42060. Clarify that placement new requires an explicit declaration. Differential Revision: https://reviews.llvm.org/D63561 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@364423 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaExprCXX.cpp')
-rw-r--r--lib/Sema/SemaExprCXX.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/Sema/SemaExprCXX.cpp b/lib/Sema/SemaExprCXX.cpp
index b59f3faa6e..32b35ba7c3 100644
--- a/lib/Sema/SemaExprCXX.cpp
+++ b/lib/Sema/SemaExprCXX.cpp
@@ -2413,7 +2413,11 @@ bool Sema::FindAllocationFunctions(SourceLocation StartLoc, SourceRange Range,
}
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;
}