diff options
Diffstat (limited to 'clang/test/SemaCXX/vararg-non-pod.cpp')
| -rw-r--r-- | clang/test/SemaCXX/vararg-non-pod.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/clang/test/SemaCXX/vararg-non-pod.cpp b/clang/test/SemaCXX/vararg-non-pod.cpp index da06d957180..f1ab9b162ce 100644 --- a/clang/test/SemaCXX/vararg-non-pod.cpp +++ b/clang/test/SemaCXX/vararg-non-pod.cpp @@ -17,6 +17,10 @@ void t1() g(10, c); // expected-warning{{cannot pass object of non-POD type 'C' through variadic function; call will abort at runtime}} g(10, version); + + void (*ptr)(int, ...) = g; + ptr(10, c); // expected-warning{{cannot pass object of non-POD type 'C' through variadic function; call will abort at runtime}} + ptr(10, version); } void t2() @@ -25,9 +29,17 @@ void t2() c.g(10, c); // expected-warning{{cannot pass object of non-POD type 'C' through variadic method; call will abort at runtime}} c.g(10, version); - + + void (C::*ptr)(int, ...) = &C::g; + (c.*ptr)(10, c); // TODO: This should also warn. + (c.*ptr)(10, version); + C::h(10, c); // expected-warning{{cannot pass object of non-POD type 'C' through variadic function; call will abort at runtime}} C::h(10, version); + + void (*static_ptr)(int, ...) = &C::h; + static_ptr(10, c); // expected-warning{{cannot pass object of non-POD type 'C' through variadic function; call will abort at runtime}} + static_ptr(10, version); } int (^block)(int, ...); |

