diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp index fb9cec1b78764..aa7de722c3e94 100644 --- a/clang/lib/Sema/SemaDeclCXX.cpp +++ b/clang/lib/Sema/SemaDeclCXX.cpp @@ -4568,6 +4568,7 @@ Sema::BuildMemInitializer(Decl *ConstructorD, MarkAnyDeclReferenced(TyD->getLocation(), TyD, /*OdrUse=*/false); TypeLocBuilder TLB; + // FIXME: This is missing building the UsingType for TyD, if any. if (const auto *TD = dyn_cast(TyD)) { BaseType = Context.getTagType(ElaboratedTypeKeyword::None, SS.getScopeRep(), TD, /*OwnsTag=*/false); @@ -4581,6 +4582,12 @@ Sema::BuildMemInitializer(Decl *ConstructorD, TLB.push(BaseType).set( /*ElaboratedKeywordLoc=*/SourceLocation(), SS.getWithLocInContext(Context), IdLoc); + } else if (auto *UD = dyn_cast(TyD)) { + BaseType = Context.getUnresolvedUsingType(ElaboratedTypeKeyword::None, + SS.getScopeRep(), UD); + TLB.push(BaseType).set( + /*ElaboratedKeywordLoc=*/SourceLocation(), + SS.getWithLocInContext(Context), IdLoc); } else { // FIXME: What else can appear here? assert(SS.isEmpty()); diff --git a/clang/test/SemaTemplate/class-template-ctor-initializer.cpp b/clang/test/SemaTemplate/class-template-ctor-initializer.cpp index 6dae20774585e..43a3986fea845 100644 --- a/clang/test/SemaTemplate/class-template-ctor-initializer.cpp +++ b/clang/test/SemaTemplate/class-template-ctor-initializer.cpp @@ -4,8 +4,8 @@ template struct A {}; -template struct B : A { - B() : A() {} +template struct B : A { + B() : A() {} }; B x; @@ -76,3 +76,12 @@ namespace NonDependentError { Derived1 d1; Derived2 d2; } + +namespace UnresolvedUsing { + template class A { + using typename T::B; + struct C : B { + C() : B() {} + }; + }; +} // namespace UnresolvedUsing