When searching for an instantiated declaration requires instantiation

of its parent context, be sure to update the parent-context pointer
after instantiation. Fixes two anonymous-union instantiation issues in
<rdar://problem/8635664>.

llvm-svn: 118313
This commit is contained in:
Douglas Gregor 2010-11-05 23:22:45 +00:00
parent efabb123af
commit 25edf4302f
2 changed files with 23 additions and 0 deletions

View File

@ -2753,6 +2753,8 @@ NamedDecl *Sema::FindInstantiatedDecl(SourceLocation Loc, NamedDecl *D,
if (!Tag->isBeingDefined() &&
RequireCompleteType(Loc, T, diag::err_incomplete_type))
return 0;
ParentDC = Tag->getDecl();
}
}

View File

@ -17,3 +17,24 @@ struct T1 : public T0, public T {
struct A : public T0 { };
void f1(T1<A> *S) { S->f0(); } // expected-note{{instantiation of member function}}
namespace rdar8635664 {
template<typename T>
struct X {
struct inner;
struct inner {
union {
int x;
float y;
};
typedef T type;
};
};
void test() {
X<int>::inner i;
i.x = 0;
}
}