2018-03-05 Nathan Sidwell <nathan@acm.org>
PR c++/84694
* friend.c (do_friend): Restore check for identifier_p inside
TEMPLATE_ID_EXPR.
PR c++/84694
* g++.dg/template/pr84694.C: New.
===================================================================
@@ -495,7 +495,8 @@ do_friend (tree ctype, tree declarator,
if (TREE_CODE (declarator) == TEMPLATE_ID_EXPR)
{
declarator = TREE_OPERAND (declarator, 0);
- declarator = OVL_NAME (declarator);
+ if (!identifier_p (declarator))
+ declarator = OVL_NAME (declarator);
}
if (ctype)
===================================================================
@@ -0,0 +1,6 @@
+// PR c++84694 ICE on friend decl
+template<typename>
+struct a {
+ template<int ()> void b();
+ friend void b<0>(); // ICEd with useless friend decl
+};