On Wed, Mar 21, 2018 at 12:01:58PM -0400, Jason Merrill wrote: > On Wed, Mar 21, 2018 at 4:42 AM, Jakub Jelinek <ja...@redhat.com> wrote: > > On Tue, Mar 20, 2018 at 05:00:34PM -0400, Jason Merrill wrote: > >> On Mon, Mar 19, 2018 at 3:50 PM, Jakub Jelinek <ja...@redhat.com> wrote: > >> > +int a(__attribute__((b((int)__builtin_inf() * 1ULL / auto)))); > >> > >> This seems like another situation like 84610 and 84642 that Alex sent > >> a patch for, of 'auto' in an attribute wrongly being treated as an > >> implicit template parameter. As I suggested in response to his patch, > >> we ought to disable auto_is_implicit_function_parm_p within an > >> attribute-specifier. > > > > Ok, for this specific testcase I'll wait for Alex. That doesn't mean > > the FIX_TRUNC_EXPR handling isn't completely wrong though. > > So, shall we fix it anyway, or remove or just gcc_unreachable ()? > > It was added in PR51150 (it couldn't work even at that point, > > cp_build_unary_op would use wrong return type even back then), but the > > testcase never invokes this anymore, uses CAST_EXPR, STATIC_CAST_EXPR etc. > > instead. > > Hmm, I think remove. It should then hit the gcc_unreachable() in tsubst_copy.
To my surprise, with latest Alex' changes tsubst_copy_and_build is still called with FIX_TRUNC_EXPR (the (int) __builtin_inf () expression), 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)? 2018-03-22 Jakub Jelinek <ja...@redhat.com> PR c++/84942 * pt.c (tsubst_copy_and_build): Remove FIX_TRUNC_EXPR handling. * g++.dg/cpp1y/pr84942.C: New test. --- gcc/cp/pt.c.jj 2018-03-20 13:53:32.265938570 +0100 +++ gcc/cp/pt.c 2018-03-21 17:25:36.155977417 +0100 @@ -17513,10 +17513,6 @@ tsubst_copy_and_build (tree t, RECUR (TREE_OPERAND (t, 0)), complain|decltype_flag)); - case FIX_TRUNC_EXPR: - RETURN (cp_build_unary_op (FIX_TRUNC_EXPR, RECUR (TREE_OPERAND (t, 0)), - false, complain)); - case ADDR_EXPR: op1 = TREE_OPERAND (t, 0); if (TREE_CODE (op1) == LABEL_DECL) --- gcc/testsuite/g++.dg/cpp1y/pr84942.C.jj 2018-03-19 11:04:16.201588211 +0100 +++ gcc/testsuite/g++.dg/cpp1y/pr84942.C 2018-03-19 11:02:37.950609950 +0100 @@ -0,0 +1,7 @@ +// 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 } +// { dg-error "declared as implicit template" "" { target *-*-* } .-2 } Jakub