Index: lib/AST/Expr.cpp =================================================================== --- lib/AST/Expr.cpp +++ lib/AST/Expr.cpp @@ -2738,12 +2738,27 @@ return false; } +/// \brief Returns true if the expression is a MemberExpr +/// with a dependent type. +static bool isDependentMember(const Expr *E) +{ + if (const auto ME = dyn_cast_or_null(E)) + if (const auto Member = ME->getMemberDecl()) + return Member->getType()->isDependentType(); + + return false; +} + /// hasAnyTypeDependentArguments - Determines if any of the expressions /// in Exprs is type-dependent. bool Expr::hasAnyTypeDependentArguments(ArrayRef Exprs) { - for (unsigned I = 0; I < Exprs.size(); ++I) - if (Exprs[I]->isTypeDependent()) + for (const auto E : Exprs) { + if (isa(E)) { + if (isDependentMember(E)) + return true; + } else if (E->isTypeDependent()) return true; + } return false; } Index: test/CXX/class.access/class.access.dcl/p1.cpp =================================================================== --- test/CXX/class.access/class.access.dcl/p1.cpp +++ test/CXX/class.access/class.access.dcl/p1.cpp @@ -56,7 +56,7 @@ }; } -struct Opaque0 {}; +struct Opaque0 {}; // expected-note-re 1-2 {{candidate constructor {{.*}}}} namespace test1 { struct A { @@ -196,7 +196,7 @@ } void test5() { - Opaque0 _ = hiding; + Opaque0 _ = hiding; // expected-error {{no viable conversion from 'int' to 'Opaque0'}} } }; } Index: test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p4.cpp =================================================================== --- test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p4.cpp +++ test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p4.cpp @@ -29,7 +29,7 @@ }; } -struct Opaque0 {}; +struct Opaque0 {}; // expected-note-re 1-2{{candidate constructor {{.*}}}} namespace test1 { struct A { @@ -112,7 +112,7 @@ } void test5() { - Opaque0 _ = hiding; + Opaque0 _ = hiding; // expected-error {{no viable conversion from 'int' to 'Opaque0'}} } }; } Index: test/SemaTemplate/template-with-invalid-decl.cpp =================================================================== --- test/SemaTemplate/template-with-invalid-decl.cpp +++ test/SemaTemplate/template-with-invalid-decl.cpp @@ -0,0 +1,16 @@ +// RUN: %clang_cc1 -verify %s + +class UBS; + +template struct FIBH +{ + FIBH() { GDN(BS); } // expected-error {{use of undeclared identifier 'GDN'}} + class UBS* BS; +}; + +extern void foo() +{ + FIBH IBH; +} + +extern void GDN(UBS* BS);