On Tue, Apr 14, 2015 at 09:16:32AM +0200, Marek Polacek wrote: > On Fri, Apr 10, 2015 at 04:31:34AM +0100, Adam Butcher wrote: > > +/* Return true iff our current scope is a default capturing generic lambda > > + defined within a template. */ > > + > > +bool > > +parsing_default_capturing_generic_lambda_in_template (void) > > +{ > > + if (processing_template_decl && current_class_type) > > + if (tree lam = CLASSTYPE_LAMBDA_EXPR (current_class_type)) > > + if (LAMBDA_EXPR_DEFAULT_CAPTURE_MODE (lam) != CPLD_NONE) > > + if (tree callop = lambda_function (lam)) > > + if (DECL_TEMPLATE_INFO (callop) > > + && (DECL_TEMPLATE_RESULT (DECL_TI_TEMPLATE (callop)) > > + == callop) > > + && ((current_nonlambda_class_type () > > + && CLASSTYPE_TEMPLATE_INFO (current_nonlambda_class_type ())) > > + || ((current_nonlambda_function () > > + && DECL_TEMPLATE_INFO (current_nonlambda_function ()))))) > > + return true; > > + return false; > > +} > > + > > Eek, why not &&s rather than cascading ifs?
Perhaps because of the lam / callop declarations. Even a large && is not that readable, I'd say best would be to just use separate ifs with return false. if (!processing_template_decl || !current_class_type) return false; tree lam = CLASSTYPE_LAMBDA_EXPR (current_class_type); if (!lam || LAMBDA_EXPR_DEFAULT_CAPTURE_MODE (lam) == CPLD_NONE) return false; tree callop = lambda_function (lam); if (!callop) return false; ... Jakub