mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-04-13 16:01:22 +08:00
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
This commit is contained in:
parent
0ee285909b
commit
b2725ea5df
@ -1,5 +1,8 @@
|
||||
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
|
||||
|
@ -1,5 +1,8 @@
|
||||
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.
|
||||
|
||||
|
20
gcc/testsuite/g++.dg/cpp1y/var-templ61.C
Normal file
20
gcc/testsuite/g++.dg/cpp1y/var-templ61.C
Normal file
@ -0,0 +1,20 @@
|
||||
// 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" }
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user