From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id C5B743846410; Wed, 24 Apr 2024 22:07:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C5B743846410 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1713996454; bh=9nujj7GL75Uw5WDzJDkeVOh1pXpKUoCoUJZ3+VoJ8yY=; h=From:To:Subject:Date:From; b=FlTMglnVt/Pf/ryu+DLFu4mPOVMGh/fzx7cXJfJog3C2iBk8PF0n/JMp6BlXCw6Y3 rYsTC0HCyZYDlbMl8lZh3YzouUazEcGE9qczLWML+VnK65R8G8i69h4v52LFvwTrYl SfhilVu2Lm/01vB1/eVN/BSucAUcWfnTaR+Q87jM= From: "jason at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/114841] New: [P0522R0] partial ordering of template template parameters Date: Wed, 24 Apr 2024 22:07:34 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jason at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D114841 Bug ID: 114841 Summary: [P0522R0] partial ordering of template template parameters Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: jason at gcc dot gnu.org Target Milestone: --- Created attachment 58029 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D58029&action=3Dedit WIP patch against r8-7277-g515f874faf4562 In the 2016 CWG discussion of making P0522R0 actually work, I proposed the adjustment that I implemented in r7-5537-g31bfc9b9dd65ec and drafted as * X is an invented class template with the template parameter list of A, including default arguments, except that during partial ordering (14.5.6.2), for each non-parameter-pack template parameter of A, the corresponding template parameter of X has a default argument which is compatible with any other template-argument. In a reply, Richard Smith noted that this would wrongly accept this example: template struct match2; template class t1,typename T> struct match2, typename t1::type > { typedef int type; }; // #5=20= =20=20=20=20=20=20=20 template class t2,typename T0,typename T1> struct match2, typename t2::type > { typedef int type; }; = // #6=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 template struct Q { typedef int type; }; match2, int> m; and indeed GCC still chooses #6, which is questionable since t1 cannot reasonably be deduced to be both t2 and t2. I worked on implementing this in 2017 but never finished. His alternative suggestion was still to introduce a default argument, but instead of having it match any other template argument, base the default on= the actual arguments, i.e. T1 or T0. I worked on this for a while in 2017 but didn't finish. Now that Clang is implementing this (https://github.com/llvm/llvm-project/pull/89807), it would be nice to fini= sh it up.=