From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1051 invoked by alias); 22 Jun 2013 17:11:44 -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 1038 invoked by uid 89); 22 Jun 2013 17:11:43 -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; Sat, 22 Jun 2013 17:11:42 +0000 Received: by mail.axiomatics.org (Postfix, from userid 1000) id B0EB7ED5C; Sat, 22 Jun 2013 12:11:40 -0500 (CDT) From: Gabriel Dos Reis To: Andrew Sutton Cc: gcc-patches@gcc.gnu.org Subject: Re: [c++-concepts]: constraint association In-Reply-To: (Andrew Sutton's message of "Sat, 22 Jun 2013 11:55:52 -0500") References: Date: Sat, 22 Jun 2013 17:11:00 -0000 Message-ID: <87ppvejcj7.fsf@euclid.axiomatics.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2013-06/txt/msg01327.txt.bz2 Andrew Sutton writes: | I the long term, I think we'll end up having constraints attached to | declarations wherever we constrain auto (PARM_DECL, VAR_DECL, etc). | Although now that I'm looking, it seems that lang_decl_parm does not | inherit lang_min. Hmm... | | Mostly, though, I'm not sure where I could put it where both | TEMPLATE_DECL and FUNCTION_DECL would have constraints. I think we want constraints for: * FUNCTION_DECL * TEMPLATE_DECL * TYPE_DECL * TEMPLATE_PARM_DECL Internally, we want to always store the canonical form of a decl, not the source-level form -- the current g++ AST isn't prepared for that (I wish it was, but it isn't.) This allows for simple comparison and other semantics processing. When we have void sort(Range& r); and Range is a unary concept, this make 'sort' a TEMPLATE_DECL. I am not sure we actually want to make the PARM_DECL 'r' to have a constraint. Rather, we want the internal representation to store the canonical form: template requires Range<__T1> void sort(__T1& r); so that the PARM_DECL 'r' never gets a constraint -- it is its type that is constrained. This way, duplicate_decls for example won't need extensive surgery to remain unconfused. -- Gaby