public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/114841] New: [P0522R0] partial ordering of template template parameters
@ 2024-04-24 22:07 jason at gcc dot gnu.org
  2024-04-24 22:08 ` [Bug c++/114841] " jason at gcc dot gnu.org
  2024-04-30 22:02 ` jason at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: jason at gcc dot gnu.org @ 2024-04-24 22:07 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114841

            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=58029&action=edit
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

<ins>* 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.</ins>

In a reply, Richard Smith noted that this would wrongly accept this example:

template<typename T, typename U> struct match2;

template<template<typename A> class t1,typename T>
struct match2<t1<T>, typename t1<T>::type > { typedef int type; }; // #5        

template<template<typename B, typename C> class t2,typename T0,typename T1>
struct match2<t2<T0,T1>, typename t2<T0,T0>::type > { typedef int type; }; //
#6                                         

template <class T, class U = T> struct Q { typedef int type; };
match2<Q<int>, int> m;

and indeed GCC still chooses #6, which is questionable since t1<T> cannot
reasonably be deduced to be both t2<T0,T1> and t2<T0,T0>.

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 finish
it up.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug c++/114841] [P0522R0] partial ordering of template template parameters
  2024-04-24 22:07 [Bug c++/114841] New: [P0522R0] partial ordering of template template parameters jason at gcc dot gnu.org
@ 2024-04-24 22:08 ` jason at gcc dot gnu.org
  2024-04-30 22:02 ` jason at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: jason at gcc dot gnu.org @ 2024-04-24 22:08 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114841

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2024-04-24
             Blocks|                            |114840
     Ever confirmed|0                           |1


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114840
[Bug 114840] [meta-bug] template template parameters

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug c++/114841] [P0522R0] partial ordering of template template parameters
  2024-04-24 22:07 [Bug c++/114841] New: [P0522R0] partial ordering of template template parameters jason at gcc dot gnu.org
  2024-04-24 22:08 ` [Bug c++/114841] " jason at gcc dot gnu.org
@ 2024-04-30 22:02 ` jason at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: jason at gcc dot gnu.org @ 2024-04-30 22:02 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114841

--- Comment #1 from Jason Merrill <jason at gcc dot gnu.org> ---
Matheus' suggested wording:

"When performing deduction such that both A and P are template template
params, and A is the template name of a template specialization,
instead of just deducing A in that case, we synthesize a new template
parameter from A, filling it's parameters with defaults coming from
their corresponding template specialization argument."

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-04-30 22:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-24 22:07 [Bug c++/114841] New: [P0522R0] partial ordering of template template parameters jason at gcc dot gnu.org
2024-04-24 22:08 ` [Bug c++/114841] " jason at gcc dot gnu.org
2024-04-30 22:02 ` jason at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).