From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31402 invoked by alias); 24 Jun 2013 17:16:36 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 31392 invoked by uid 89); 24 Jun 2013 17:16:36 -0000 X-Spam-SWARE-Status: No, score=-3.9 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED,RP_MATCHES_RCVD autolearn=ham version=3.3.1 Received: from www.axiomatics.org (HELO mail.axiomatics.org) (66.228.53.191) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Mon, 24 Jun 2013 17:16:35 +0000 Received: by mail.axiomatics.org (Postfix, from userid 1000) id BEB44ED5C; Mon, 24 Jun 2013 12:16:33 -0500 (CDT) From: Gabriel Dos Reis To: Andrew Sutton Cc: gcc-patches@gcc.gnu.org, jason@redhat.com Subject: Re: [c++-concepts]: constraint association In-Reply-To: (Andrew Sutton's message of "Mon, 24 Jun 2013 10:56:47 -0500") References: <87ppvejcj7.fsf@euclid.axiomatics.org> <87sj0ayp9a.fsf@euclid.axiomatics.org> <87obaxzrdc.fsf@euclid.axiomatics.org> <87k3lln22z.fsf@euclid.axiomatics.org> Date: Mon, 24 Jun 2013 17:16:00 -0000 Message-ID: <87zjufxwcu.fsf@euclid.axiomatics.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2013-06/txt/msg01394.txt.bz2 Andrew Sutton 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