summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/warn-new-overaligned.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2014-01-17 02:09:33 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2014-01-17 02:09:33 +0000
commit2c6b449098dc0047f4697b2f822a7c7e56c32f43 (patch)
tree7a5cee6e7fbab5fc1286248d2db7b20040445c54 /clang/test/SemaCXX/warn-new-overaligned.cpp
parente9d2bfc7e95b89c4ab5715d3036ff7489c5ef233 (diff)
downloadbcm5719-llvm-2c6b449098dc0047f4697b2f822a7c7e56c32f43.tar.gz
bcm5719-llvm-2c6b449098dc0047f4697b2f822a7c7e56c32f43.zip
Issue a warning if a throwing operator new or operator new[] returns a null
pointer, since this invokes undefined behavior. Based on a patch by Artyom Skrobov! Handling of dependent exception specifications and some additional testcases by me. llvm-svn: 199452
Diffstat (limited to 'clang/test/SemaCXX/warn-new-overaligned.cpp')
-rw-r--r--clang/test/SemaCXX/warn-new-overaligned.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/clang/test/SemaCXX/warn-new-overaligned.cpp b/clang/test/SemaCXX/warn-new-overaligned.cpp
index 42a4e3523ad..710973ccb32 100644
--- a/clang/test/SemaCXX/warn-new-overaligned.cpp
+++ b/clang/test/SemaCXX/warn-new-overaligned.cpp
@@ -38,7 +38,7 @@ struct Test {
} __attribute__((aligned(256)));
void* operator new(unsigned long) {
- return 0;
+ return 0; // expected-warning {{'operator new' should not return a null pointer unless it is declared 'throw()'}}
}
SeparateCacheLines<int> high_contention_data[10];
@@ -59,7 +59,7 @@ struct Test {
} __attribute__((aligned(256)));
void* operator new[](unsigned long) {
- return 0;
+ return 0; // expected-warning {{'operator new[]' should not return a null pointer unless it is declared 'throw()'}}
}
SeparateCacheLines<int> high_contention_data[10];
OpenPOWER on IntegriCloud