summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/printf-block.cpp
diff options
context:
space:
mode:
authorCharles Li <charles_li@playstation.sony.com>2015-11-11 19:34:47 +0000
committerCharles Li <charles_li@playstation.sony.com>2015-11-11 19:34:47 +0000
commit542f04cc4d53cf3effd96a633205adbb022dc245 (patch)
treec0b928779c175c4f57339986a512dc4cabf3bf20 /clang/test/SemaCXX/printf-block.cpp
parent99f23473a18ccdcdaeb50883da15aa606b8f1ddf (diff)
downloadbcm5719-llvm-542f04cc4d53cf3effd96a633205adbb022dc245.tar.gz
bcm5719-llvm-542f04cc4d53cf3effd96a633205adbb022dc245.zip
[Lit Test] Updated 26 Lit tests to be C++11 compatible.
Expected diagnostics have been expanded to vary by C++ dialect. RUN line has also been expanded to: default, C++98/03 and C++11. llvm-svn: 252785
Diffstat (limited to 'clang/test/SemaCXX/printf-block.cpp')
-rw-r--r--clang/test/SemaCXX/printf-block.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/clang/test/SemaCXX/printf-block.cpp b/clang/test/SemaCXX/printf-block.cpp
index 4a580037e73..b9d06d6c4fe 100644
--- a/clang/test/SemaCXX/printf-block.cpp
+++ b/clang/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