Commit b2725ea5 by Jakub Jelinek Committed by Jakub Jelinek

re PR c++/89512 (ICE in get_expr_operands, at tree-ssa-operands.c:882)

	PR c++/89512
	* semantics.c (finish_qualified_id_expr): Reject variable templates.

	* g++.dg/cpp1y/var-templ61.C: New test.

From-SVN: r269672
parent 0ee28590
2019-03-14 Jakub Jelinek <jakub@redhat.com>
PR c++/89512
* semantics.c (finish_qualified_id_expr): Reject variable templates.
PR c++/89652
* constexpr.c (struct constexpr_ctx): Change save_exprs type from
hash_set<tree> to vec<tree>.
......
......@@ -2112,6 +2112,14 @@ finish_qualified_id_expr (tree qualifying_class,
expr = build_offset_ref (qualifying_class, expr, /*address_p=*/false,
complain);
}
else if (!template_p
&& TREE_CODE (expr) == TEMPLATE_DECL
&& !DECL_FUNCTION_TEMPLATE_P (expr))
{
if (complain & tf_error)
error ("%qE missing template arguments", expr);
return error_mark_node;
}
else
{
/* In a template, return a SCOPE_REF for most qualified-ids
......
2019-03-14 Jakub Jelinek <jakub@redhat.com>
PR c++/89512
* g++.dg/cpp1y/var-templ61.C: New test.
PR c++/89652
* g++.dg/cpp1y/constexpr-89652.C: New test.
......
// PR c++/89512
// { dg-do compile { target c++14 } }
struct A {
template <typename T>
static const int a = 0;
};
struct B {
template <typename T>
static int foo ()
{
return T::a; // { dg-error "missing template arguments" }
}
};
int bar ()
{
return B::foo<A> (); // { dg-message "required from here" }
}
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