From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26081 invoked by alias); 2 Nov 2010 12:44:58 -0000 Received: (qmail 26073 invoked by uid 22791); 2 Nov 2010 12:44:57 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,MISSING_MID X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 02 Nov 2010 12:44:52 +0000 From: "dodji at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/45606] [4.5/4.6 Regression] match a method prototyped a typedef alias with the original type (using stdlib) X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Keywords: rejects-valid X-Bugzilla-Severity: normal X-Bugzilla-Who: dodji at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: dodji at gcc dot gnu.org X-Bugzilla-Target-Milestone: 4.5.2 X-Bugzilla-Changed-Fields: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Date: Tue, 02 Nov 2010 12:44:00 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2010-11/txt/msg00101.txt.bz2 Message-ID: <20101102124400.4KNxfkA5Um8TLYxyzCajHyXQ43aKBMv12QOMJnZJZSA@z> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45606 --- Comment #5 from Dodji Seketeli 2010-11-02 12:44:23 UTC --- Author: dodji Date: Tue Nov 2 12:44:19 2010 New Revision: 166179 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=166179 Log: Restore canonical type comparison for dependent type(def)s This patch restores canonical type comparison for dependent types and then dependent typedefs. After this patch, two template type parameters T are equal if they have the same index, level, *and* number of sibling parameters. The novelty is to take in account the number of sibling parameters. To do this we first build the template parameters w/o taking in account their number of siblings. When we know the number of template parameters we fix up each template parameter with the number of slibling parameters and we build the appropriate canonical types accordingly. The patch fixes the fallouts deemed necessary. This fixes PR c++/45606 but actually fixes all the previous bugs related to dependent typedef comparison we had since we started to properly representing dependent typedefs. gcc/cp/ChangeLog: PR c++/45606 * cp-tree.h (TEMPLATE_TYPE_PARM_SIBLING_PARMS): Remove. (struct template_parm_index_s): New field. (TEMPLATE_PARM_NUM_SIBLINGS): New accessor. (process_template_parm): Extend the API to accept the number of template parms in argument. (cp_set_underlying_type): Remove this. * class.c (build_self_reference): Require canonical type equality back on the self reference of class. * decl2.c (grokfield): Require canonical type equality back on typedef class fields. * name-lookup.c (pushdecl_maybe_friend): Require canonical type equality back on typedefs. * parser.c (cp_parser_template_parameter_list): Do not require canonical type equality on dependent types created during template parameters parsing. * pt.c (fixup_template_type_parm_type, fixup_template_parm_index) (fixup_template_parm, fixup_template_parms): New private functions. (current_template_args): Declare this. (process_template_parm): Pass the total number of template parms to canonical_type_parameter. (build_template_parm_index): Add a new argument to carry the total number of template parms. (reduce_template_parm_level, process_template_parm, make_auto): Adjust. (current_template_args): Fix this for template template parameters. (tsubst_template_parm): Split out of ... (tsubst_template_parms): ... this. (reduce_template_parm_level): Don't loose TEMPLATE_PARM_NUM_SIBLINGS when cloning a TEMPLATE_PARM_INDEX. (template_parm_to_arg): Extracted this function from current_template_args. Make it represent invalid template parms with an error_mark_node instead of a LIST_TREE containing an error_mark_node. (current_template_args): Use template_parm_to_arg. (dependent_template_arg_p): Consider an invalid template argument as dependent. (end_template_parm_list): Do not update template sibling parms here anymore. Use fixup_template_parms instead. (process_template_parm): Pass the number of template parms to canonical_type_parameter. (make_auto): Require structural equality on auto TEMPLATE_TYPE_PARM for now. (unify): Coerce template parameters using all the arguments deduced so far. (tsubst): Pass the number of sibling parms to canonical_type_parameter. * tree.c (cp_set_underlying_type): Remove. * typeck.c (get_template_parms_of_dependent_type) (incompatible_dependent_types_p): Remove. (structural_comptypes): Do not call incompatible_dependent_types_p anymore. (comp_template_parms_position): Re-organized. Take the length of template parms list in account. gcc/testsuite/ChangeLog: PR c++/45606 * g++.dg/template/typedef36.C: New test. * gcc/testsuite/g++.dg/template/canon-type-9.C: Likewise. * g++.dg/template/canon-type-10.C: Likewise. * g++.dg/template/canon-type-11.C: Likewise. * g++.dg/template/canon-type-12.C: Likewise. * g++.dg/template/canon-type-13.C: Likewise. Added: trunk/gcc/testsuite/g++.dg/template/canon-type-10.C trunk/gcc/testsuite/g++.dg/template/canon-type-11.C trunk/gcc/testsuite/g++.dg/template/canon-type-12.C trunk/gcc/testsuite/g++.dg/template/canon-type-13.C trunk/gcc/testsuite/g++.dg/template/canon-type-9.C trunk/gcc/testsuite/g++.dg/template/typedef36.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/class.c trunk/gcc/cp/cp-tree.h trunk/gcc/cp/decl2.c trunk/gcc/cp/name-lookup.c trunk/gcc/cp/parser.c trunk/gcc/cp/pt.c trunk/gcc/cp/tree.c trunk/gcc/cp/typeck.c trunk/gcc/testsuite/ChangeLog