diff options
| author | Akira Hatanaka <ahatanaka@apple.com> | 2017-06-26 17:39:48 +0000 |
|---|---|---|
| committer | Akira Hatanaka <ahatanaka@apple.com> | 2017-06-26 17:39:48 +0000 |
| commit | 393b55ffe2b56ea2e44828edc79db3f14e1e10f1 (patch) | |
| tree | 2fa493bd758c662ccf4d0314ab179fe7f6fa47f0 /libcxx/test/std/language.support | |
| parent | e79b07e41e2a6a0166718c94e5747e13bb84ef77 (diff) | |
| download | bcm5719-llvm-393b55ffe2b56ea2e44828edc79db3f14e1e10f1.tar.gz bcm5719-llvm-393b55ffe2b56ea2e44828edc79db3f14e1e10f1.zip | |
[libcxx] Annotate c++17 aligned new/delete operators with availability
attribute.
This is needed because older versions of libc++ do not have these
operators. If users target an older deployment target and try to compile
programs in which these operators are explicitly called, the compiler
will complain.
The following is the list of minimum deployment targets for the four
OSes:
macosx: 10.13
ios: 11.0
tvos: 11.0
watchos: 4.0
rdar://problem/32664169
Differential Revision: https://reviews.llvm.org/D34556
llvm-svn: 306310
Diffstat (limited to 'libcxx/test/std/language.support')
| -rw-r--r-- | libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.placement/new_deployment.fail.cpp | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.placement/new_deployment.fail.cpp b/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.placement/new_deployment.fail.cpp new file mode 100644 index 00000000000..f9f487dc7ef --- /dev/null +++ b/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.placement/new_deployment.fail.cpp @@ -0,0 +1,36 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03, c++11, c++14 +// REQUIRES: availability=macosx10.12 + +// test availability of new/delete operators introduced in c++17. + +#include <new> + +int main () { + int *p0 = new ((std::align_val_t)16) int(1); + (void)p0; + int *p1 = new ((std::align_val_t)16) int[1]; + (void)p1; + // expected-error@-4 {{call to unavailable function 'operator new': introduced in macOS 10.13}} + // expected-note@new:* {{candidate function has been explicitly made unavailable}} + // expected-note@new:* {{candidate function not viable: no known conversion from 'std::align_val_t' to 'const std::nothrow_t' for 2nd argument}} + // expected-note@new:* {{candidate function not viable: no known conversion from 'std::align_val_t' to 'void *' for 2nd argument}} + // expected-note@new:* {{candidate function not viable: requires single argument '__sz', but 2 arguments were provided}} + // expected-note@new:* {{candidate function not viable: requires 3 arguments, but 2 were provided}} + + // expected-error@-9 {{call to unavailable function 'operator new[]': introduced in macOS 10.13}} + // expected-note@new:* {{candidate function has been explicitly made unavailable}} + // expected-note@new:* {{candidate function not viable: no known conversion from 'std::align_val_t' to 'const std::nothrow_t' for 2nd argument}} + // expected-note@new:* {{candidate function not viable: no known conversion from 'std::align_val_t' to 'void *' for 2nd argument}} + // expected-note@new:* {{candidate function not viable: requires single argument '__sz', but 2 arguments were provided}} + // expected-note@new:* {{candidate function not viable: requires 3 arguments, but 2 were provided}} + return 0; +} |

