When emitting a diagnostic about two-phase name lookup, don't do useless

qualified name lookups into transparent contexts.

llvm-svn: 152739
This commit is contained in:
Nick Lewycky 2012-03-14 20:41:00 +00:00
parent dcc425ec19
commit fcd5e7a160
2 changed files with 22 additions and 0 deletions

View File

@ -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()) {

View File

@ -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}}
}
}
}
}