diff options
-rw-r--r-- | lib/Sema/SemaOverload.cpp | 3 | ||||
-rw-r--r-- | test/SemaCXX/warn-unused-value.cpp | 19 |
2 files changed, 22 insertions, 0 deletions
diff --git a/lib/Sema/SemaOverload.cpp b/lib/Sema/SemaOverload.cpp index fe999b1599..b93fb093fa 100644 --- a/lib/Sema/SemaOverload.cpp +++ b/lib/Sema/SemaOverload.cpp @@ -9244,6 +9244,9 @@ DiagnoseTwoPhaseLookup(Sema &SemaRef, SourceLocation FnLoc, return false; for (DeclContext *DC = SemaRef.CurContext; DC; DC = DC->getParent()) { + if (DC->isTransparentContext()) + continue; + SemaRef.LookupQualifiedName(R, DC); if (!R.empty()) { diff --git a/test/SemaCXX/warn-unused-value.cpp b/test/SemaCXX/warn-unused-value.cpp index 80298ec666..1c0263c581 100644 --- a/test/SemaCXX/warn-unused-value.cpp +++ b/test/SemaCXX/warn-unused-value.cpp @@ -30,3 +30,22 @@ void b(Foo f1, Foo f2) { } #undef NOP } + +namespace test2 { + extern "C" { + namespace std { + template<typename T> struct basic_string { + struct X {}; + void method() const { + X* x; + &x[0]; // expected-warning {{expression result unused}} + } + }; + typedef basic_string<char> string; + void func(const std::string& str) { + str.method(); // expected-note {{in instantiation of member function}} + } + } + } +} + |