diff options
Diffstat (limited to 'test/SemaCXX/cast-conversion.cpp')
| -rw-r--r-- | test/SemaCXX/cast-conversion.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/SemaCXX/cast-conversion.cpp b/test/SemaCXX/cast-conversion.cpp new file mode 100644 index 000000000000..cbc24aef28d5 --- /dev/null +++ b/test/SemaCXX/cast-conversion.cpp @@ -0,0 +1,21 @@ +// RUN: clang-cc -fsyntax-only -verify %s -std=c++0x + +struct R { + R(int); +}; + +struct A { + A(R); +}; + +struct B { + B(A); +}; + +int main () { + B(10); // expected-error {{functional-style cast from 'int' to 'struct B' is not allowed}} + (B)10; // expected-error {{C-style cast from 'int' to 'struct B' is not allowed}} + static_cast<B>(10); // expected-error {{static_cast from 'int' to 'struct B' is not allowed}} \\ + // expected-warning {{expression result unused}} +} + |
