diff options
Diffstat (limited to 'test/SemaCXX')
-rw-r--r-- | test/SemaCXX/attr-no-sanitize-address.cpp | 16 | ||||
-rw-r--r-- | test/SemaCXX/attr-no-sanitize-memory.cpp | 16 | ||||
-rw-r--r-- | test/SemaCXX/attr-no-sanitize-thread.cpp | 16 | ||||
-rw-r--r-- | test/SemaCXX/dllexport.cpp | 7 | ||||
-rw-r--r-- | test/SemaCXX/warn-literal-conversion.cpp | 11 |
5 files changed, 41 insertions, 25 deletions
diff --git a/test/SemaCXX/attr-no-sanitize-address.cpp b/test/SemaCXX/attr-no-sanitize-address.cpp index 0aafe06..9499742 100644 --- a/test/SemaCXX/attr-no-sanitize-address.cpp +++ b/test/SemaCXX/attr-no-sanitize-address.cpp @@ -5,14 +5,14 @@ #if !__has_attribute(no_sanitize_address) #error "Should support no_sanitize_address" #endif -
-void noanal_fun() NO_SANITIZE_ADDRESS;
-
-void noanal_fun_alt() __attribute__((__no_sanitize_address__));
-
-void noanal_fun_args() __attribute__((no_sanitize_address(1))); // \
- // expected-error {{'no_sanitize_address' attribute takes no arguments}}
-
+ +void noanal_fun() NO_SANITIZE_ADDRESS; + +void noanal_fun_alt() __attribute__((__no_sanitize_address__)); + +void noanal_fun_args() __attribute__((no_sanitize_address(1))); // \ + // expected-error {{'no_sanitize_address' attribute takes no arguments}} + int noanal_testfn(int y) NO_SANITIZE_ADDRESS; int noanal_testfn(int y) { diff --git a/test/SemaCXX/attr-no-sanitize-memory.cpp b/test/SemaCXX/attr-no-sanitize-memory.cpp index 8a8d847..41809a0 100644 --- a/test/SemaCXX/attr-no-sanitize-memory.cpp +++ b/test/SemaCXX/attr-no-sanitize-memory.cpp @@ -5,14 +5,14 @@ #if !__has_attribute(no_sanitize_memory) #error "Should support no_sanitize_memory" #endif -
-void noanal_fun() NO_SANITIZE_MEMORY;
-
-void noanal_fun_alt() __attribute__((__no_sanitize_memory__));
-
-void noanal_fun_args() __attribute__((no_sanitize_memory(1))); // \
- // expected-error {{'no_sanitize_memory' attribute takes no arguments}}
-
+ +void noanal_fun() NO_SANITIZE_MEMORY; + +void noanal_fun_alt() __attribute__((__no_sanitize_memory__)); + +void noanal_fun_args() __attribute__((no_sanitize_memory(1))); // \ + // expected-error {{'no_sanitize_memory' attribute takes no arguments}} + int noanal_testfn(int y) NO_SANITIZE_MEMORY; int noanal_testfn(int y) { diff --git a/test/SemaCXX/attr-no-sanitize-thread.cpp b/test/SemaCXX/attr-no-sanitize-thread.cpp index 92a3fa9..d97e050 100644 --- a/test/SemaCXX/attr-no-sanitize-thread.cpp +++ b/test/SemaCXX/attr-no-sanitize-thread.cpp @@ -5,14 +5,14 @@ #if !__has_attribute(no_sanitize_thread) #error "Should support no_sanitize_thread" #endif -
-void noanal_fun() NO_SANITIZE_THREAD;
-
-void noanal_fun_alt() __attribute__((__no_sanitize_thread__));
-
-void noanal_fun_args() __attribute__((no_sanitize_thread(1))); // \
- // expected-error {{'no_sanitize_thread' attribute takes no arguments}}
-
+ +void noanal_fun() NO_SANITIZE_THREAD; + +void noanal_fun_alt() __attribute__((__no_sanitize_thread__)); + +void noanal_fun_args() __attribute__((no_sanitize_thread(1))); // \ + // expected-error {{'no_sanitize_thread' attribute takes no arguments}} + int noanal_testfn(int y) NO_SANITIZE_THREAD; int noanal_testfn(int y) { diff --git a/test/SemaCXX/dllexport.cpp b/test/SemaCXX/dllexport.cpp index a32ba44..0bbf9b37 100644 --- a/test/SemaCXX/dllexport.cpp +++ b/test/SemaCXX/dllexport.cpp @@ -730,7 +730,12 @@ __declspec(dllexport) int MemberRedecl::StaticField = 1; // expect __declspec(dllexport) const int MemberRedecl::StaticConstField = 1; // expected-error{{redeclaration of 'MemberRedecl::StaticConstField' cannot add 'dllexport' attribute}} __declspec(dllexport) constexpr int MemberRedecl::ConstexprField; // expected-error{{redeclaration of 'MemberRedecl::ConstexprField' cannot add 'dllexport' attribute}} - +#ifdef MS +struct __declspec(dllexport) ClassWithMultipleDefaultCtors { + ClassWithMultipleDefaultCtors(int = 40) {} // expected-error{{'__declspec(dllexport)' cannot be applied to more than one default constructor}} + ClassWithMultipleDefaultCtors(int = 30, ...) {} // expected-note{{declared here}} +}; +#endif //===----------------------------------------------------------------------===// // Class member templates diff --git a/test/SemaCXX/warn-literal-conversion.cpp b/test/SemaCXX/warn-literal-conversion.cpp index d7bec4c..5d4b6f7 100644 --- a/test/SemaCXX/warn-literal-conversion.cpp +++ b/test/SemaCXX/warn-literal-conversion.cpp @@ -38,3 +38,14 @@ void test0() { int y = (24*60*60) * 0.25; int pennies = 123.45 * 100; } + +// Similarly, test floating point conversion to bool. Only float values of zero +// are converted to false; everything else is converted to true. +void test1() { + bool b1 = 0.99f; // expected-warning {{implicit conversion from 'float' to 'bool' changes value from 0.99 to true}} + bool b2 = 0.99; // expected-warning {{implicit conversion from 'double' to 'bool' changes value from 0.99 to true}} + // These do not warn because they can be directly converted to integral + // values. + bool b3 = 0.0f; + bool b4 = 0.0; +} |