Kazu Hirata wrote: > Hi Mark, > > I have a question about your patch for PR c++/26534.
> When build_unary_op builds TRUTH_NOT_EXPR, it calls > perform_implicit_conversion to convert p->field to the boolean type. > (FWIW, p->field is expressed as <component_ref <indirect_ref ...> > <field_ref ...>>). The call to perform_implicit_conversion eventually > gets to standard_conversion. The code fragment of standard_conversion > shown above changes FROM to the boolean_type. Since TO is also the > boolean type, no conversion happens, causing > perform_implicit_conversion to return the original expression, which > is of INTEGER_TYPE. > > invert_truthvalue, called from cp/typeck.c:3969, expects nothing but > expressions of BOOLEAN_TYPE, so it ICEs at fold-const.c:3165. Thanks for the analysis. > Now, is the code in standard_conversion meant to be an optimization or > something that's required for language conformance? If the latter is > the case, can we somehow force a conversion? It is indeed required for conformance. The key idea is that standard_conversion is working out what sequence of conversions to perform; then, convert_like_real will actually perform the conversions. The sequence of conversions is mandated by the standard. I believe that, therefore, the correct fix will be to teach convert_like_real to make the appropriate adjustment; I'm testing that now. Thanks, -- Mark Mitchell CodeSourcery [EMAIL PROTECTED] (650) 331-3385 x713