diff options
Diffstat (limited to 'test/Parser/cxx-casting.cpp')
-rw-r--r-- | test/Parser/cxx-casting.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/test/Parser/cxx-casting.cpp b/test/Parser/cxx-casting.cpp index 69680e4..d2c97b8 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 ';'}} |