diff options
Diffstat (limited to 'test/SemaCXX/vararg-non-pod.cpp')
-rw-r--r-- | test/SemaCXX/vararg-non-pod.cpp | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/test/SemaCXX/vararg-non-pod.cpp b/test/SemaCXX/vararg-non-pod.cpp index 977df14..f913531 100644 --- a/test/SemaCXX/vararg-non-pod.cpp +++ b/test/SemaCXX/vararg-non-pod.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify -fblocks %s +// RUN: clang-cc -fsyntax-only -verify -fblocks %s -Wnon-pod-varargs extern char version[]; @@ -66,3 +66,25 @@ void t5() E e(10, c); // expected-warning{{cannot pass object of non-POD type 'class C' through variadic constructor; call will abort at runtime}} (void)E(10, c); // expected-warning{{cannot pass object of non-POD type 'class C' through variadic constructor; call will abort at runtime}} } + +// PR5761: unevaluated operands and the non-POD warning +class Foo { + public: + Foo() {} +}; + +int Helper(...); +const int size = sizeof(Helper(Foo())); + +namespace std { + class type_info { }; +} + +struct Base { virtual ~Base(); }; +Base &get_base(...); +int eat_base(...); + +void test_typeid(Base &base) { + (void)typeid(get_base(base)); // expected-warning{{cannot pass object of non-POD type 'struct Base' through variadic function; call will abort at runtime}} + (void)typeid(eat_base(base)); // okay +} |