aboutsummaryrefslogtreecommitdiff
path: root/test/SemaCXX/old-style-cast.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/SemaCXX/old-style-cast.cpp')
-rw-r--r--test/SemaCXX/old-style-cast.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/SemaCXX/old-style-cast.cpp b/test/SemaCXX/old-style-cast.cpp
new file mode 100644
index 000000000000..73a78e40ac35
--- /dev/null
+++ b/test/SemaCXX/old-style-cast.cpp
@@ -0,0 +1,11 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin -fsyntax-only -verify -Wold-style-cast %s
+
+void test1() {
+ long x = (long)12; // expected-warning {{use of old-style cast}}
+ (long)x; // expected-warning {{use of old-style cast}} expected-warning {{expression result unused}}
+ (void**)x; // expected-warning {{use of old-style cast}} expected-warning {{expression result unused}}
+ long y = static_cast<long>(12);
+ (void)y;
+ typedef void VOID;
+ (VOID)y;
+}