[C++ PATCH] Fix FIX_TRUNC_EXPR instantiation (PR c++/84942)
Jakub Jelinek
jakub@redhat.com
Fri Mar 23 14:22:00 GMT 2018
On Thu, Mar 22, 2018 at 02:02:01PM -0400, Jason Merrill wrote:
> He hadn't yet checked in the relevant change, "Disable
> auto_is_implicit_function_template_parm_p while parsing attributes".
> That should happen soon.
>
> > but with
> > the following patch we don't ICE, because args is NULL and
> > tsubst_copy starts with:
> > 14945 if (t == NULL_TREE || t == error_mark_node || args == NULL_TREE)
> > 14946 return t;
> > So, do you still want the FIX_TRUNC_EXPR handling removed or fixed (as done
> > in the first patch)?
>
> Hmm, let's make it gcc_unreachable then.
So like this? Passes make check-c++-all on current trunk, where the above
patch from Alex is already in.
2018-03-23 Jakub Jelinek <jakub@redhat.com>
PR c++/84942
* pt.c (tsubst_copy_and_build) <case FIX_TRUNC_EXPR>: Replace
cp_build_unary_op call with gcc_unreachable ().
* g++.dg/cpp1y/pr84942.C: New test.
--- gcc/cp/pt.c.jj 2018-03-23 09:49:38.063519286 +0100
+++ gcc/cp/pt.c 2018-03-23 09:51:24.232501064 +0100
@@ -17514,8 +17514,7 @@ tsubst_copy_and_build (tree t,
complain|decltype_flag));
case FIX_TRUNC_EXPR:
- RETURN (cp_build_unary_op (FIX_TRUNC_EXPR, RECUR (TREE_OPERAND (t, 0)),
- false, complain));
+ gcc_unreachable ();
case ADDR_EXPR:
op1 = TREE_OPERAND (t, 0);
--- gcc/testsuite/g++.dg/cpp1y/pr84942.C.jj 2018-03-23 09:50:16.320512716 +0100
+++ gcc/testsuite/g++.dg/cpp1y/pr84942.C 2018-03-23 09:52:33.408489183 +0100
@@ -0,0 +1,6 @@
+// PR c++/84942
+// { dg-do compile { target c++14 } }
+// { dg-options "-w" }
+
+int a(__attribute__((b((int)__builtin_inf() * 1ULL / auto))));
+// { dg-error "expected primary-expression before" "" { target *-*-* } .-1 }
Jakub
More information about the Gcc-patches
mailing list