On Tue, Feb 13, 2018 at 10:43 AM, Paolo Carlini <paolo.carl...@oracle.com> wrote: > On 13/02/2018 15:35, Jason Merrill wrote: > 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...
Hmm, yes, that should work. In a template we're just figuring out the result type, at instantiation time we'll see the missing middle op again and can do the right thing. OK. Jason