diff options
Diffstat (limited to 'test/SemaCXX/unused.cpp')
-rw-r--r-- | test/SemaCXX/unused.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/test/SemaCXX/unused.cpp b/test/SemaCXX/unused.cpp index fbaf8c8bf3c12..09a179e7bb851 100644 --- a/test/SemaCXX/unused.cpp +++ b/test/SemaCXX/unused.cpp @@ -1,4 +1,6 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s // PR4103 : Make sure we don't get a bogus unused expression warning namespace PR4103 { @@ -28,8 +30,14 @@ namespace PR4103 { namespace derefvolatile { void f(volatile char* x) { - *x; // expected-warning {{expression result unused; assign into a variable to force a volatile load}} - (void)*x; // expected-warning {{expression result unused; assign into a variable to force a volatile load}} + *x; +#if __cplusplus <= 199711L + // expected-warning@-2 {{expression result unused; assign into a variable to force a volatile load}} +#endif + (void)*x; +#if __cplusplus <= 199711L + // expected-warning@-2 {{expression result unused; assign into a variable to force a volatile load}} +#endif volatile char y = 10; (void)y; // don't warn here, because it's a common pattern. } |