Index: lib/Sema/SemaStmtAsm.cpp =================================================================== --- lib/Sema/SemaStmtAsm.cpp +++ lib/Sema/SemaStmtAsm.cpp @@ -623,16 +623,12 @@ if (!LookupName(BaseResult, getCurScope())) return true; - - LookupResult CurrBaseResult(BaseResult); - + + if(!BaseResult.isSingleResult()) + return true; + NamedDecl *FoundDecl = BaseResult.getFoundDecl(); for (StringRef NextMember : Members) { - - if (!CurrBaseResult.isSingleResult()) - return true; - const RecordType *RT = nullptr; - NamedDecl *FoundDecl = CurrBaseResult.getFoundDecl(); if (VarDecl *VD = dyn_cast(FoundDecl)) RT = VD->getType()->getAs(); else if (TypedefNameDecl *TD = dyn_cast(FoundDecl)) { @@ -655,13 +651,15 @@ if (!LookupQualifiedName(FieldResult, RT->getDecl())) return true; + if (!FieldResult.isSingleResult()) + return true; + FoundDecl = FieldResult.getFoundDecl(); + // FIXME: Handle IndirectFieldDecl? - FieldDecl *FD = dyn_cast(FieldResult.getFoundDecl()); + FieldDecl *FD = dyn_cast(FoundDecl); if (!FD) return true; - CurrBaseResult = FieldResult; - const ASTRecordLayout &RL = Context.getASTRecordLayout(RT->getDecl()); unsigned i = FD->getFieldIndex(); CharUnits Result = Context.toCharUnitsFromBits(RL.getFieldOffset(i)); Index: test/CodeGen/ms-inline-asm-errors.cpp =================================================================== --- test/CodeGen/ms-inline-asm-errors.cpp +++ test/CodeGen/ms-inline-asm-errors.cpp @@ -0,0 +1,15 @@ +// REQUIRES: x86-registered-target +// RUN: %clang_cc1 -x c++ %s -triple i386-apple-darwin10 -std=c++11 -fasm-blocks -verify + +class A { +public: + void foo(int a) {} + void foo(float a) {} +}; + + +void t_fail() { + __asm { + mov ecx, [eax]A.foo // expected-error {{Unable to lookup field reference!}} + } +}