From 9940a5df86d36ecc69ee3a82e1a4fbfe841960ab Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Wed, 16 Oct 2013 16:21:04 +0000 Subject: Sema: Simplify the check if a method returns an instance of the class. Just checking if the parent of the method is the same as the return type should be sufficient. Also fixes PR17587. llvm-svn: 192802 --- clang/test/SemaCXX/warn-unused-result.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'clang/test') diff --git a/clang/test/SemaCXX/warn-unused-result.cpp b/clang/test/SemaCXX/warn-unused-result.cpp index b0bf61f3818..581af09080d 100644 --- a/clang/test/SemaCXX/warn-unused-result.cpp +++ b/clang/test/SemaCXX/warn-unused-result.cpp @@ -78,3 +78,19 @@ void lazy() { DoYetAnotherThing(); } } + +namespace PR17587 { +struct [[clang::warn_unused_result]] Status; + +struct Foo { + Status Bar(); +}; + +struct Status {}; + +void Bar() { + Foo f; + f.Bar(); // expected-warning {{ignoring return value}} +}; + +} -- cgit v1.2.3