summaryrefslogtreecommitdiffstats
path: root/test/SemaCXX/printf-block.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/SemaCXX/printf-block.cpp')
-rw-r--r--test/SemaCXX/printf-block.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/test/SemaCXX/printf-block.cpp b/test/SemaCXX/printf-block.cpp
index 4a58003..b9d06d6 100644
--- a/test/SemaCXX/printf-block.cpp
+++ b/test/SemaCXX/printf-block.cpp
@@ -1,4 +1,6 @@
// RUN: %clang_cc1 -fsyntax-only -fblocks -Wformat -verify %s -Wno-error=non-pod-varargs
+// RUN: %clang_cc1 -fsyntax-only -fblocks -Wformat -verify %s -Wno-error=non-pod-varargs -std=c++98
+// RUN: %clang_cc1 -fsyntax-only -fblocks -Wformat -verify %s -Wno-error=non-pod-varargs -std=c++11
int (^block) (int, const char *,...) __attribute__((__format__(__printf__,2,3))) = ^ __attribute__((__format__(__printf__,2,3))) (int arg, const char *format,...) {return 5;};
@@ -14,5 +16,11 @@ void test_block() {
HasNoCStr hncs(str);
int n = 4;
block(n, "%s %d", str, n); // no-warning
- block(n, "%s %s", hncs, n); // expected-warning{{cannot pass non-POD object of type 'HasNoCStr' to variadic block; expected type from format string was 'char *'}} expected-warning{{format specifies type 'char *' but the argument has type 'int'}}
+ block(n, "%s %s", hncs, n);
+#if __cplusplus <= 199711L // C++03 or earlier modes
+ // expected-warning@-2{{cannot pass non-POD object of type 'HasNoCStr' to variadic block; expected type from format string was 'char *'}}
+#else
+ // expected-warning@-4{{format specifies type 'char *' but the argument has type 'HasNoCStr'}}
+#endif
+ // expected-warning@-6{{format specifies type 'char *' but the argument has type 'int'}}
}
OpenPOWER on IntegriCloud