From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15154 invoked by alias); 20 Sep 2011 00:02:49 -0000 Received: (qmail 15145 invoked by uid 22791); 20 Sep 2011 00:02:48 -0000 X-SWARE-Spam-Status: No, hits=-6.7 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 20 Sep 2011 00:02:28 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p8K02Smi022315 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 19 Sep 2011 20:02:28 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p8K02Rle011871; Mon, 19 Sep 2011 20:02:27 -0400 Received: from [0.0.0.0] (ovpn-113-145.phx2.redhat.com [10.3.113.145]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id p8K02QgO029003; Mon, 19 Sep 2011 20:02:26 -0400 Message-ID: <4E77D811.5000701@redhat.com> Date: Tue, 20 Sep 2011 01:53:00 -0000 From: Jason Merrill User-Agent: Mozilla/5.0 (X11; Linux i686; rv:6.0.2) Gecko/20110906 Thunderbird/6.0.2 MIME-Version: 1.0 To: =?UTF-8?B?RmFiaWVuIENow6puZQ==?= CC: gcc-patches@gcc.gnu.org Subject: Re: [Patch] PR c++/26256 References: <4C0EB10C.3050701@redhat.com> <4C1AD953.3020008@redhat.com> <4C6E0571.3070802@redhat.com> <4D1279FD.6010706@redhat.com> <4D7297F5.2000708@redhat.com> <4E020BE2.7080207@redhat.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit 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 X-SW-Source: 2011-09/txt/msg01120.txt.bz2 On 09/17/2011 09:44 AM, Fabien Chêne wrote: > I tried various things without success, and I ended up hacking > supplement_binding_1 to handle those ENUMERAL_TYPEs. > I am all ear for another solution ... Your solution seems reasonable to me, but it needs a comment, along the lines of /* We allow pushing an enum multiple times in a class template in order to handle late matching of underlying type on an opaque-enum-declaration followed by an enum-specifier. */ And I guess limit it to dependent class scope. Incidentally, repeating opaque-enum-declarations at class scope is invalid under 9.2/1: -- A member shall not be declared twice in the member-specification, except that a nested class or member class template can be declared and then later defined, and except that an enumeration can be introduced with an opaque-enum-declaration and later redeclared with an enum-specifier. -- So struct A { enum E: int; enum E: int { e1 }; }; is OK, but struct B { enum E: int; enum E: int; }; is not. > +static tree > +strip_using_decl (tree decl) Needs a comment. Also, this function has a loop in it, but various other places in the patch that look through USING_DECLs don't loop. > if (!DECL_DEPENDENT_P (field)) > - continue; > + { > + tree using_decl = USING_DECL_DECLS (field); > + if ((TREE_CODE (using_decl) == FIELD_DECL > + || TREE_CODE (using_decl) == TYPE_DECL) > + && DECL_NAME (using_decl) == name) > + return using_decl; > + continue; > + } This section needs a comment. Why do we look through USING_DECL for these two kinds of member but not others?