Index: lib/AST/Expr.cpp =================================================================== --- lib/AST/Expr.cpp +++ lib/AST/Expr.cpp @@ -1560,6 +1560,13 @@ MemberExpr *E = new (Mem) MemberExpr(base, isarrow, OperatorLoc, memberdecl, nameinfo, ty, vk, ok); + if (!isa(memberdecl)) { + DeclContext *DC = memberdecl->getDeclContext(); + CXXRecordDecl *RD = dyn_cast(DC); + if (RD && RD->isDependentContext() && RD->isCurrentInstantiation(DC)) + E->setTypeDependent(ty->isDependentType()); + } + if (hasQualOrFound) { // FIXME: Wrong. We should be looking at the member declaration we found. if (QualifierLoc && QualifierLoc.getNestedNameSpecifier()->isDependent()) { Index: lib/Sema/SemaChecking.cpp =================================================================== --- lib/Sema/SemaChecking.cpp +++ lib/Sema/SemaChecking.cpp @@ -14125,6 +14125,8 @@ bool AnyIsPacked = false; do { QualType BaseType = ME->getBase()->getType(); + if (BaseType->isDependentType()) + return; if (ME->isArrow()) BaseType = BaseType->getPointeeType(); RecordDecl *RD = BaseType->getAs()->getDecl(); Index: test/SemaTemplate/dependent-names.cpp =================================================================== --- test/SemaTemplate/dependent-names.cpp +++ test/SemaTemplate/dependent-names.cpp @@ -273,9 +273,6 @@ } int e[10]; }; - void g() { - S().f(); // expected-note {{here}} - } } namespace A2 { Index: test/SemaTemplate/enum-argument.cpp =================================================================== --- test/SemaTemplate/enum-argument.cpp +++ test/SemaTemplate/enum-argument.cpp @@ -1,5 +1,4 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s -// expected-no-diagnostics enum Enum { val = 1 }; template struct C { @@ -31,7 +30,7 @@ unsigned long long bitfield : e0; void f(int j) { - bitfield + j; + bitfield + j; // expected-warning {{expression result unused}} } }; } Index: test/SemaTemplate/member-access-expr.cpp =================================================================== --- test/SemaTemplate/member-access-expr.cpp +++ test/SemaTemplate/member-access-expr.cpp @@ -156,7 +156,7 @@ void get(B **ptr) { // It's okay if at some point we figure out how to diagnose this // at instantiation time. - *ptr = field; + *ptr = field; // expected-error {{assigning to 'test6::B *' from incompatible type 'test6::A *}} } }; } Index: test/SemaTemplate/non-integral-switch-cond.cpp =================================================================== --- /dev/null +++ test/SemaTemplate/non-integral-switch-cond.cpp @@ -0,0 +1,14 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +struct NOT_AN_INTEGRAL_TYPE {}; + +template +struct foo { + NOT_AN_INTEGRAL_TYPE Bad; + void run() { + switch (Bad) { // expected-error {{statement requires expression of integer type ('NOT_AN_INTEGRAL_TYPE' invalid)}} + case 0: + break; + } + } +};