[Bug c++/89512] [7/8/9 Regression] ICE in get_expr_operands, at tree-ssa-operands.c:882

2019-03-22 Thread paolo.carlini at oracle dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89512

Paolo Carlini  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
 CC|jakub at gcc dot gnu.org   |
   Assignee|unassigned at gcc dot gnu.org  |jakub at gcc dot gnu.org

[Bug c++/89512] [7/8/9 Regression] ICE in get_expr_operands, at tree-ssa-operands.c:882

2019-03-21 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89512

Marek Polacek  changed:

   What|Removed |Added

 CC||mpolacek at gcc dot gnu.org

--- Comment #4 from Marek Polacek  ---
So fixed on trunk?

[Bug c++/89512] [7/8/9 Regression] ICE in get_expr_operands, at tree-ssa-operands.c:882

2019-03-14 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89512

--- Comment #3 from Jakub Jelinek  ---
Author: jakub
Date: Thu Mar 14 08:14:48 2019
New Revision: 269672

URL: https://gcc.gnu.org/viewcvs?rev=269672=gcc=rev
Log:
PR c++/89512
* semantics.c (finish_qualified_id_expr): Reject variable templates.

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

Added:
trunk/gcc/testsuite/g++.dg/cpp1y/var-templ61.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/semantics.c
trunk/gcc/testsuite/ChangeLog

[Bug c++/89512] [7/8/9 Regression] ICE in get_expr_operands, at tree-ssa-operands.c:882

2019-03-13 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89512

--- Comment #2 from Jakub Jelinek  ---
Slightly cleaned up testcase:
struct A {
  template 
  static const int a = 0;
};
struct B {
  template 
  static int foo ()
  {
return T::a;
  }
};
int bar ()
{
  return B::foo ();
}

Outside of a template this is caught by finish_id_expression_1 doing:
  /* If we didn't find anything, or what we found was a type,
 then this wasn't really an id-expression.  */
  if (TREE_CODE (decl) == TEMPLATE_DECL
  && !DECL_FUNCTION_TEMPLATE_P (decl))
{
  *error_msg = G_("missing template arguments");
  return error_mark_node;
}
but in this case, we don't call finish_id_expression, but go through
tsubst_qualified_id -> finish_qualified_id_expr
So, I wonder if we shouldn't handle this in the latter, something like:
--- gcc/cp/semantics.c.jj   2019-03-08 11:45:27.556465237 +0100
+++ gcc/cp/semantics.c  2019-03-13 17:24:46.260345284 +0100
@@ -2112,6 +2112,14 @@ finish_qualified_id_expr (tree qualifyin
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", DECL_TEMPLATE_RESULT (expr));
+  return error_mark_node;
+}
   else
 {
   /* In a template, return a SCOPE_REF for most qualified-ids

[Bug c++/89512] [7/8/9 Regression] ICE in get_expr_operands, at tree-ssa-operands.c:882

2019-02-26 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89512

Jakub Jelinek  changed:

   What|Removed |Added

   Priority|P3  |P2
 Status|UNCONFIRMED |NEW
   Last reconfirmed||2019-02-26
 CC||jakub at gcc dot gnu.org,
   ||jason at gcc dot gnu.org
   Target Milestone|--- |7.5
Summary|ICE in get_expr_operands,   |[7/8/9 Regression] ICE in
   |at tree-ssa-operands.c:882  |get_expr_operands, at
   ||tree-ssa-operands.c:882
 Ever confirmed|0   |1

--- Comment #1 from Jakub Jelinek  ---
Started with r214396.