forked from OSchip/llvm-project
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:
parent
dcc425ec19
commit
fcd5e7a160
|
@ -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()) {
|
||||
|
|
|
@ -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}}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue