diff options
Diffstat (limited to 'test/SemaCXX/unused.cpp')
-rw-r--r-- | test/SemaCXX/unused.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/test/SemaCXX/unused.cpp b/test/SemaCXX/unused.cpp index 54898c8..fbaf8c8 100644 --- a/test/SemaCXX/unused.cpp +++ b/test/SemaCXX/unused.cpp @@ -34,3 +34,30 @@ namespace derefvolatile { (void)y; // don't warn here, because it's a common pattern. } } + +// <rdar://problem/12359208> +namespace AnonObject { + struct Foo { + Foo(const char* const message); + ~Foo(); + }; + void f() { + Foo("Hello World!"); // don't warn + int(1); // expected-warning {{expression result unused}} + } +} + +// Test that constructing an object (which may have side effects) with +// constructor arguments which are dependent doesn't produce an unused value +// warning. +namespace UnresolvedLookup { + struct Foo { + Foo(int i, int j); + }; + template <typename T> + struct Bar { + void f(T t) { + Foo(t, 0); // no warning + } + }; +} |