diff options
author | Tim Northover <tnorthover@apple.com> | 2017-12-09 12:09:54 +0000 |
---|---|---|
committer | Tim Northover <tnorthover@apple.com> | 2017-12-09 12:09:54 +0000 |
commit | 36bb6d5d467350fa8056237cde4c5147a82f5938 (patch) | |
tree | 4a423aa78e3e1c7d3c1117fff1c4f9d1963431b5 /clang/test/SemaCXX/new-delete.cpp | |
parent | 6504a8f8880f50e6f2e83df6053bd351e92bc794 (diff) | |
download | bcm5719-llvm-36bb6d5d467350fa8056237cde4c5147a82f5938.tar.gz bcm5719-llvm-36bb6d5d467350fa8056237cde4c5147a82f5938.zip |
Switch to gnu++14 as the default dialect.
This is C++14 with conforming GNU extensions.
llvm-svn: 320250
Diffstat (limited to 'clang/test/SemaCXX/new-delete.cpp')
-rw-r--r-- | clang/test/SemaCXX/new-delete.cpp | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/clang/test/SemaCXX/new-delete.cpp b/clang/test/SemaCXX/new-delete.cpp index cb0d030d99c..870a5921d25 100644 --- a/clang/test/SemaCXX/new-delete.cpp +++ b/clang/test/SemaCXX/new-delete.cpp @@ -80,12 +80,21 @@ void bad_news(int *ip) (void)new int[1.1]; #if __cplusplus <= 199711L // expected-error@-2 {{array size expression must have integral or enumeration type, not 'double'}} -#else +#elif __cplusplus <= 201103L // expected-error@-4 {{array size expression must have integral or unscoped enumeration type, not 'double'}} +#else + // expected-warning@-6 {{implicit conversion from 'double' to 'unsigned int' changes value from 1.1 to 1}} #endif - (void)new int[1][i]; // expected-error {{only the first dimension}} expected-note {{read of non-const variable 'i' is not allowed in a constant expression}} - (void)new (int[1][i]); // expected-error {{only the first dimension}} expected-note {{read of non-const variable 'i' is not allowed in a constant expression}} + (void)new int[1][i]; // expected-note {{read of non-const variable 'i' is not allowed in a constant expression}} + (void)new (int[1][i]); // expected-note {{read of non-const variable 'i' is not allowed in a constant expression}} +#if __cplusplus <= 201103L + // expected-error@-3 {{only the first dimension}} + // expected-error@-3 {{only the first dimension}} +#else + // expected-error@-6 {{array size is not a constant expression}} + // expected-error@-6 {{array size is not a constant expression}} +#endif (void)new (int[i]); // expected-warning {{when type is in parentheses}} (void)new int(*(S*)0); // expected-error {{no viable conversion from 'S' to 'int'}} (void)new int(1, 2); // expected-error {{excess elements in scalar initializer}} @@ -94,13 +103,20 @@ void bad_news(int *ip) (void)new const int; // expected-error {{default initialization of an object of const type 'const int'}} (void)new float*(ip); // expected-error {{cannot initialize a new value of type 'float *' with an lvalue of type 'int *'}} // Undefined, but clang should reject it directly. - (void)new int[-1]; // expected-error {{array size is negative}} + (void)new int[-1]; +#if __cplusplus <= 201103L + // expected-error@-2 {{array size is negative}} +#else + // expected-error@-4 {{array is too large}} +#endif (void)new int[2000000000]; // expected-error {{array is too large}} (void)new int[*(S*)0]; #if __cplusplus <= 199711L // expected-error@-2 {{array size expression must have integral or enumeration type, not 'S'}} -#else +#elif __cplusplus <= 201103L // expected-error@-4 {{array size expression must have integral or unscoped enumeration type, not 'S'}} +#else + // expected-error@-6 {{converting 'S' to incompatible type}} #endif (void)::S::new int; // expected-error {{expected unqualified-id}} |