Commit 6970223f by Jason Merrill Committed by Jason Merrill

PR c++/71738 - nested template friend

	* pt.c (lookup_template_class_1): Handle getting template from tsubst.

From-SVN: r238685
parent a6c690f4
2016-07-23 Jason Merrill <jason@redhat.com>
PR c++/71738
* pt.c (lookup_template_class_1): Handle getting template from tsubst.
PR c++/71350
* decl.c (reshape_init_r): Check complain for missing braces warning.
......
......@@ -8601,7 +8601,9 @@ lookup_template_class_1 (tree d1, tree arglist, tree in_decl, tree context,
for parameters in the TYPE_DECL of the alias template
done earlier. So be careful while getting the template
of FOUND. */
found = TREE_CODE (found) == TYPE_DECL
found = TREE_CODE (found) == TEMPLATE_DECL
? found
: TREE_CODE (found) == TYPE_DECL
? TYPE_TI_TEMPLATE (TREE_TYPE (found))
: CLASSTYPE_TI_TEMPLATE (found);
}
......
// PR c++/71738
template < class > struct S
{
template < class > struct A
{
template < class > struct B
{
template <class Z>
void operator=(Z) { S::i = 0; }
};
};
// Note that this friend declaration is useless, since nested classes are
// already friends of their enclosing class.
template < class X >
template < class Y >
template < class Z >
friend void A < X >::B < Y >::operator= (Z);
private:
static int i;
};
int main()
{
S<int>::A<int>::B<int> b;
b = 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment