@@ -169,14 +169,16 @@ bool CXXBasePaths::lookupInBases(ASTContext &Context,
169169 // Find the record of the base class subobjects for this type.
170170 QualType BaseType =
171171 Context.getCanonicalType (BaseSpec.getType ()).getUnqualifiedType ();
172+ bool isCurrentInstantiation = isa<InjectedClassNameType>(BaseType);
172173
173174 // C++ [temp.dep]p3:
174175 // In the definition of a class template or a member of a class template,
175176 // if a base class of the class template depends on a template-parameter,
176177 // the base class scope is not examined during unqualified name lookup
177178 // either at the point of definition of the class template or member or
178179 // during an instantiation of the class tem- plate or member.
179- if (!LookupInDependent && BaseType->isDependentType ())
180+ if (!LookupInDependent &&
181+ (BaseType->isDependentType () && !isCurrentInstantiation))
180182 continue ;
181183
182184 // Determine whether we need to visit this base class at all,
@@ -244,9 +246,8 @@ bool CXXBasePaths::lookupInBases(ASTContext &Context,
244246 return FoundPath;
245247 }
246248 } else if (VisitBase) {
247- CXXRecordDecl *BaseRecord;
249+ CXXRecordDecl *BaseRecord = nullptr ;
248250 if (LookupInDependent) {
249- BaseRecord = nullptr ;
250251 const TemplateSpecializationType *TST =
251252 BaseSpec.getType ()->getAs <TemplateSpecializationType>();
252253 if (!TST) {
@@ -265,8 +266,7 @@ bool CXXBasePaths::lookupInBases(ASTContext &Context,
265266 BaseRecord = nullptr ;
266267 }
267268 } else {
268- BaseRecord = cast<CXXRecordDecl>(
269- BaseSpec.getType ()->castAs <RecordType>()->getDecl ());
269+ BaseRecord = cast<CXXRecordDecl>(BaseSpec.getType ()->getAsRecordDecl ());
270270 }
271271 if (BaseRecord &&
272272 lookupInBases (Context, BaseRecord, BaseMatches, LookupInDependent)) {
0 commit comments