Andrew Sutton <andrew.n.sut...@gmail.com> writes: | Revisions from previous patch. | | I've taken constraint_info out of lang_decl_min and made it specific | to TEMPLATE_DECLs by saving it as DECL_SIZE_UNIT. It seems to be | unused for templates. When I start working on the shorthand notation, | I'll do something similar for template parameters and auto | declarations.
That sounds good. | The handling of non-template member functions also changes a little. | Here's a history of the revisions: | | - Current branch: the instantiated constraints are stored in | TEMPLATE_INFO and then checked in add_function_candidate. | - Previous patch: instantiated constraints are associated directly | with the member functions' FUNCTION_DECL. | - Current patch: constraints are only instantiated and checked at | the point of use. I think that should be OK for now. If and when needed, we could use a bit to say the use is OK based on the argument types. But, for the moment, I think we should be fine. In fact, we may not need that bit at all if we conduct a careful analysis. | The current patch will lead to redundant checks. I left a comment in | call.c explaining that we could use a bit in TEMPLATE_INFO to save | whether or not an instantiated declaration actually satisfies its | requirements. See comment below. | /* Return a TEMPLATE_DECL corresponding to DECL, using the indicated | - template PARMS. If MEMBER_TEMPLATE_P is true, the new template is | - a member template. Used by push_template_decl below. */ | + template PARMS and constraints, CONS. If MEMBER_TEMPLATE_P is true, | + the new template is a member template. */ | -static tree | -build_template_decl (tree decl, tree parms, bool member_template_p) | +tree | +build_template_decl (tree decl, tree parms, tree cons, bool member_template_p) | { GCC source code base is still strongly Lispy, so when one sees 'cons', one can't avoid association with the function 'cons' (even though it is in fact spelled tree_cons.) I would suggest spelling 'constraints' in full. | +// Access constraints for the declaration, NODE. | +// | +// For TEMPLATE_DECL nodes, the constraints are stored in the | +// DECL_SIZE node. | +// | +// TODO: This will need to be updated for shorthand constraints and | +// constrained auto declarations. | +#define DECL_CONSTRAINTS(NODE) \ | + (DECL_SIZE_UNIT (TEMPLATE_DECL_CHECK (NODE))) The comment should say DECL_SIZE_UNIT, not DECL_SIZE (which is used to store specializations.) Patch OK with the suggested fixes. Thanks, -- Gaby