Commit Message

For C2<T> to be considered the "current instantiation", we need to call
xref_basetypes while we're still pushed into its scope. So we can
actually simplify the code by moving the call into cp_parser_class_head.
Once we've fixed that, we need to fix tsubst_decl to handle USING_DECLs
for members of the current instantiation, since the scope can be a
dependent type even though we can do name lookup in it.
The discussion of the PR also pointed out that EDG rejects code like
template <class T> struct A
{
struct B : A { };
};
because A<T> is not complete yet. This makes sense to me, so I've added
this diagnostic as a pedwarn (so code that uses this pattern will
continue to compile for now).
Tested x86_64-pc-linux-gnu, applying the first patch to trunk and 4.7,
the second to trunk only.