This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [C++ Patch] PR 84333 ("[6/7/8 Regression] ICE with ternary operator in template function")


Hi Jason,

On 13/02/2018 15:35, Jason Merrill wrote:
OK.
Thanks. Unfortunately, I don't think I sent a complete solution for these issues. In fact we would still ICE on:

template<typename T> int foo()
{
  return sizeof(T) > 1 ? : 1;
}

because type_contains_placeholder_p doesn't know how to handle a TEMPLATE_TYPE_PARM. In fact, cp_save_expr teaches me something:

tree
cp_save_expr (tree expr)
{
  /* There is no reason to create a SAVE_EXPR within a template; if
     needed, we can create the SAVE_EXPR when instantiating the
     template.  Furthermore, the middle-end cannot handle C++-specific
     tree codes.  */
  if (processing_template_decl)
    return expr;
  return save_expr (expr);
}

would it be correct to just use it? Or we have to do something more complex? Note the issue only affects the GNU-extension with omitted middle operand, thus I believe we have *some* leeway...

Thanks!
Paolo.

/////////////////////

Attachment: patch_84333_2
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]