aboutsummaryrefslogtreecommitdiff
path: root/test/Parser/cxx-casting.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2014-11-24 09:15:30 +0000
committerDimitry Andric <dim@FreeBSD.org>2014-11-24 09:15:30 +0000
commit9f4dbff6669c8037f3b036bcf580d14f1a4f12a5 (patch)
tree47df2c12b57214af6c31e47404b005675b8b7ffc /test/Parser/cxx-casting.cpp
parentf73d5f23a889b93d89ddef61ac0995df40286bb8 (diff)
Notes
Diffstat (limited to 'test/Parser/cxx-casting.cpp')
-rw-r--r--test/Parser/cxx-casting.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/Parser/cxx-casting.cpp b/test/Parser/cxx-casting.cpp
index 69680e421b0da..d2c97b88b809c 100644
--- a/test/Parser/cxx-casting.cpp
+++ b/test/Parser/cxx-casting.cpp
@@ -90,5 +90,22 @@ void test3() {
// expected-error {{expected unqualified-id}}
}
+// Ensure that a C-style cast doesn't turn off colon protection.
+void PR19748() {
+ struct A {};
+ int A = 0, b;
+ int test1 = true ? (int)A : b;
+
+ struct f {};
+ extern B f(), (*p)();
+ (true ? (B(*)())f : p)();
+}
+
+void PR19751(int n) {
+ struct T { void operator++(int); };
+ (T())++; // ok, not an ill-formed cast to function type
+ (T())++n; // expected-error {{C-style cast from 'int' to 'T ()' is not allowed}}
+}
+
// PR13619. Must be at end of file.
int n = reinterpret_cast // expected-error {{expected '<'}} expected-error {{expected ';'}}