summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/builtin-object-size-cxx14.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard@metafoo.co.uk>2019-12-13 18:38:33 -0800
committerRichard Smith <richard@metafoo.co.uk>2019-12-13 18:41:54 -0800
commitc5b890e922432bd80a5e3c6d82994ef4cdc41900 (patch)
treef515c05f966401f6b8b21c2e2a0974abf0c1912c /clang/test/SemaCXX/builtin-object-size-cxx14.cpp
parent38c3b5d562ac6a5ab0ef5503838aad362af866e0 (diff)
downloadbcm5719-llvm-c5b890e922432bd80a5e3c6d82994ef4cdc41900.tar.gz
bcm5719-llvm-c5b890e922432bd80a5e3c6d82994ef4cdc41900.zip
PR44268: Fix crash if __builtin_object_size is applied to a heap
allocation.
Diffstat (limited to 'clang/test/SemaCXX/builtin-object-size-cxx14.cpp')
-rw-r--r--clang/test/SemaCXX/builtin-object-size-cxx14.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/clang/test/SemaCXX/builtin-object-size-cxx14.cpp b/clang/test/SemaCXX/builtin-object-size-cxx14.cpp
index a57bb6b5378..b7c6f6be01f 100644
--- a/clang/test/SemaCXX/builtin-object-size-cxx14.cpp
+++ b/clang/test/SemaCXX/builtin-object-size-cxx14.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify -std=c++14 %s
+// RUN: %clang_cc1 -fsyntax-only -verify=expected,cxx14 -std=c++14 %s
// RUN: %clang_cc1 -fsyntax-only -verify -std=c++2a %s
typedef __SIZE_TYPE__ size_t;
@@ -113,3 +113,9 @@ namespace InvalidBase {
constexpr size_t bos_dtor = __builtin_object_size(&(T&)(T&&)invalid_base_2(), 0);
static_assert(bos_dtor == -1, "");
}
+
+// PR44268
+constexpr int bos_new() { // cxx14-error {{constant expression}}
+ void *p = new int; // cxx14-note {{until C++20}}
+ return __builtin_object_size(p, 0);
+}
OpenPOWER on IntegriCloud