Fix crash70.C with -std=c++1z.

* semantics.c (finish_qualified_id_expr): Handle
	UNBOUND_CLASS_TEMPLATE.

From-SVN: r231352
This commit is contained in:
Jason Merrill 2015-12-06 23:35:02 -05:00 committed by Jason Merrill
parent 19dedccfc3
commit 5ea106d85b
3 changed files with 15 additions and 2 deletions

View File

@ -1,5 +1,8 @@
2015-12-06 Jason Merrill <jason@redhat.com>
* semantics.c (finish_qualified_id_expr): Handle
UNBOUND_CLASS_TEMPLATE.
* parser.c (cp_parser_template_argument): Handle references in
C++1z mode.
* constexpr.c (potential_constant_expression_1): Don't error about

View File

@ -1929,7 +1929,17 @@ finish_qualified_id_expr (tree qualifying_class,
return error_mark_node;
if (template_p)
check_template_keyword (expr);
{
if (TREE_CODE (expr) == UNBOUND_CLASS_TEMPLATE)
/* cp_parser_lookup_name thought we were looking for a type,
but we're actually looking for a declaration. */
expr = build_qualified_name (/*type*/NULL_TREE,
TYPE_CONTEXT (expr),
TYPE_IDENTIFIER (expr),
/*template_p*/true);
else
check_template_keyword (expr);
}
/* If EXPR occurs as the operand of '&', use special handling that
permits a pointer-to-member. */

View File

@ -2,6 +2,6 @@
template<int> struct A;
template<typename T> void foo (A<&T::template i>); // { dg-error "not a template" }
template<typename T> void foo (A<&T::template i>);
template void foo<A<0> > (A<0>); // { dg-error "does not match" }