public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/111485] New: Constraint mismatch on template template parameter
@ 2023-09-19 16:50 barry.revzin at gmail dot com
  2023-09-19 17:29 ` [Bug c++/111485] [11/12/13/14 Regression] " ppalka at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: barry.revzin at gmail dot com @ 2023-09-19 16:50 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 111485
           Summary: Constraint mismatch on template template parameter
           Product: gcc
           Version: 13.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: barry.revzin at gmail dot com
  Target Milestone: ---

Reduced from StackOverflow (https://stackoverflow.com/q/77136297/2069064):

template <typename T> constexpr bool regular = true;

template <typename T> concept C = regular<T>;

template<template<C> typename T> struct example { };
template<template<C> typename T> using example_t = example<T>;

gcc 13.2 rejects with:

<source>:6:61: error: constraint mismatch at argument 1 in template parameter
list for 'template<template<class> class requires  C< <template-parameter-2-1>
> T> struct example'
    6 | template<template<C> typename T> using example_t = example<T>;
      |                                                             ^
<source>:6:61: note:   expected 'template<class> class requires  C<
<template-parameter-2-1> > T' but got 'template<class> class requires  C<
<template-parameter-2-1> > T'

But this should be fine. Clang and MSVC accept. "

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

* [Bug c++/111485] [11/12/13/14 Regression] Constraint mismatch on template template parameter
  2023-09-19 16:50 [Bug c++/111485] New: Constraint mismatch on template template parameter barry.revzin at gmail dot com
@ 2023-09-19 17:29 ` ppalka at gcc dot gnu.org
  2023-09-22 10:26 ` cvs-commit at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: ppalka at gcc dot gnu.org @ 2023-09-19 17:29 UTC (permalink / raw)
  To: gcc-bugs

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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|                            |11.4.0, 12.3.0, 13.2.0,
                   |                            |14.0
   Last reconfirmed|                            |2023-09-19
   Target Milestone|---                         |11.5
      Known to work|                            |10.5.0
             Status|UNCONFIRMED                 |ASSIGNED
                 CC|                            |ppalka at gcc dot gnu.org
     Ever confirmed|0                           |1
            Summary|Constraint mismatch on      |[11/12/13/14 Regression]
                   |template template parameter |Constraint mismatch on
                   |                            |template template parameter
           Assignee|unassigned at gcc dot gnu.org      |ppalka at gcc dot gnu.org
           Keywords|                            |rejects-valid

--- Comment #1 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Started with r11-4545-ge1344fe7b6a969.

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

* [Bug c++/111485] [11/12/13/14 Regression] Constraint mismatch on template template parameter
  2023-09-19 16:50 [Bug c++/111485] New: Constraint mismatch on template template parameter barry.revzin at gmail dot com
  2023-09-19 17:29 ` [Bug c++/111485] [11/12/13/14 Regression] " ppalka at gcc dot gnu.org
@ 2023-09-22 10:26 ` cvs-commit at gcc dot gnu.org
  2023-09-24 18:42 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-09-22 10:26 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Patrick Palka <ppalka@gcc.gnu.org>:

https://gcc.gnu.org/g:6f902a42b0afe3f3145bcb864695fc290b5acc3e

commit r14-4224-g6f902a42b0afe3f3145bcb864695fc290b5acc3e
Author: Patrick Palka <ppalka@redhat.com>
Date:   Fri Sep 22 06:25:49 2023 -0400

    c++: constraint rewriting during ttp coercion [PR111485]

    In order to compare the constraints of a ttp with that of its argument,
    we rewrite the ttp's constraints in terms of the argument template's
    template parameters.  The substitution to achieve this currently uses a
    single level of template arguments, but that never does the right thing
    because a ttp's template parameters always have level >= 2.  This patch
    fixes this by including the outer template arguments in the substitution,
    which ought to match the depth of the ttp.

    The second testcase demonstrates it's better to substitute the concrete
    outer template arguments instead of generic ones since a ttp's constraints
    could depend on outer parameters.

            PR c++/111485

    gcc/cp/ChangeLog:

            * pt.cc (is_compatible_template_arg): New parameter 'args'.
            Add the outer template arguments 'args' to 'new_args'.
            (convert_template_argument): Pass 'args' to
            is_compatible_template_arg.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp2a/concepts-ttp5.C: New test.
            * g++.dg/cpp2a/concepts-ttp6.C: New test.

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

* [Bug c++/111485] [11/12/13/14 Regression] Constraint mismatch on template template parameter
  2023-09-19 16:50 [Bug c++/111485] New: Constraint mismatch on template template parameter barry.revzin at gmail dot com
  2023-09-19 17:29 ` [Bug c++/111485] [11/12/13/14 Regression] " ppalka at gcc dot gnu.org
  2023-09-22 10:26 ` cvs-commit at gcc dot gnu.org
@ 2023-09-24 18:42 ` cvs-commit at gcc dot gnu.org
  2023-12-24 15:11 ` [Bug c++/111485] [11/12 " cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-09-24 18:42 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-13 branch has been updated by Patrick Palka
<ppalka@gcc.gnu.org>:

https://gcc.gnu.org/g:59f5786c20a42be13ac6fec567ffe840045012ad

commit r13-7836-g59f5786c20a42be13ac6fec567ffe840045012ad
Author: Patrick Palka <ppalka@redhat.com>
Date:   Fri Sep 22 06:25:49 2023 -0400

    c++: constraint rewriting during ttp coercion [PR111485]

    In order to compare the constraints of a ttp with that of its argument,
    we rewrite the ttp's constraints in terms of the argument template's
    template parameters.  The substitution to achieve this currently uses a
    single level of template arguments, but that never does the right thing
    because a ttp's template parameters always have level >= 2.  This patch
    fixes this by including the outer template arguments in the substitution,
    which ought to match the depth of the ttp.

    The second testcase demonstrates it's better to substitute the concrete
    outer template arguments instead of generic ones since a ttp's constraints
    could depend on outer parameters.

            PR c++/111485

    gcc/cp/ChangeLog:

            * pt.cc (is_compatible_template_arg): New parameter 'args'.
            Add the outer template arguments 'args' to 'new_args'.
            (convert_template_argument): Pass 'args' to
            is_compatible_template_arg.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp2a/concepts-ttp5.C: New test.
            * g++.dg/cpp2a/concepts-ttp6.C: New test.

    (cherry picked from commit 6f902a42b0afe3f3145bcb864695fc290b5acc3e)

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

* [Bug c++/111485] [11/12 Regression] Constraint mismatch on template template parameter
  2023-09-19 16:50 [Bug c++/111485] New: Constraint mismatch on template template parameter barry.revzin at gmail dot com
                   ` (2 preceding siblings ...)
  2023-09-24 18:42 ` cvs-commit at gcc dot gnu.org
@ 2023-12-24 15:11 ` cvs-commit at gcc dot gnu.org
  2023-12-24 15:12 ` cvs-commit at gcc dot gnu.org
  2024-01-02 17:59 ` ppalka at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-12-24 15:11 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-12 branch has been updated by Patrick Palka
<ppalka@gcc.gnu.org>:

https://gcc.gnu.org/g:f24d6f0031fd515e6497c8c96446afd02aa4dbaa

commit r12-10068-gf24d6f0031fd515e6497c8c96446afd02aa4dbaa
Author: Patrick Palka <ppalka@redhat.com>
Date:   Fri Sep 22 06:25:49 2023 -0400

    c++: constraint rewriting during ttp coercion [PR111485]

    In order to compare the constraints of a ttp with that of its argument,
    we rewrite the ttp's constraints in terms of the argument template's
    template parameters.  The substitution to achieve this currently uses a
    single level of template arguments, but that never does the right thing
    because a ttp's template parameters always have level >= 2.  This patch
    fixes this by including the outer template arguments in the substitution,
    which ought to match the depth of the ttp.

    The second testcase demonstrates it's better to substitute the concrete
    outer template arguments instead of generic ones since a ttp's constraints
    could depend on outer parameters.

            PR c++/111485

    gcc/cp/ChangeLog:

            * pt.cc (is_compatible_template_arg): New parameter 'args'.
            Add the outer template arguments 'args' to 'new_args'.
            (convert_template_argument): Pass 'args' to
            is_compatible_template_arg.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp2a/concepts-ttp5.C: New test.
            * g++.dg/cpp2a/concepts-ttp6.C: New test.

    (cherry picked from commit 6f902a42b0afe3f3145bcb864695fc290b5acc3e)

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

* [Bug c++/111485] [11/12 Regression] Constraint mismatch on template template parameter
  2023-09-19 16:50 [Bug c++/111485] New: Constraint mismatch on template template parameter barry.revzin at gmail dot com
                   ` (3 preceding siblings ...)
  2023-12-24 15:11 ` [Bug c++/111485] [11/12 " cvs-commit at gcc dot gnu.org
@ 2023-12-24 15:12 ` cvs-commit at gcc dot gnu.org
  2024-01-02 17:59 ` ppalka at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-12-24 15:12 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Patrick Palka
<ppalka@gcc.gnu.org>:

https://gcc.gnu.org/g:84cab505d69038647d98f9340559fc941446e479

commit r11-11168-g84cab505d69038647d98f9340559fc941446e479
Author: Patrick Palka <ppalka@redhat.com>
Date:   Fri Sep 22 06:25:49 2023 -0400

    c++: constraint rewriting during ttp coercion [PR111485]

    In order to compare the constraints of a ttp with that of its argument,
    we rewrite the ttp's constraints in terms of the argument template's
    template parameters.  The substitution to achieve this currently uses a
    single level of template arguments, but that never does the right thing
    because a ttp's template parameters always have level >= 2.  This patch
    fixes this by including the outer template arguments in the substitution,
    which ought to match the depth of the ttp.

    The second testcase demonstrates it's better to substitute the concrete
    outer template arguments instead of generic ones since a ttp's constraints
    could depend on outer parameters.

            PR c++/111485

    gcc/cp/ChangeLog:

            * pt.c (is_compatible_template_arg): New parameter 'args'.
            Add the outer template arguments 'args' to 'new_args'.
            (convert_template_argument): Pass 'args' to
            is_compatible_template_arg.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp2a/concepts-ttp5.C: New test.
            * g++.dg/cpp2a/concepts-ttp6.C: New test.

    (cherry picked from commit 6f902a42b0afe3f3145bcb864695fc290b5acc3e)

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

* [Bug c++/111485] [11/12 Regression] Constraint mismatch on template template parameter
  2023-09-19 16:50 [Bug c++/111485] New: Constraint mismatch on template template parameter barry.revzin at gmail dot com
                   ` (4 preceding siblings ...)
  2023-12-24 15:12 ` cvs-commit at gcc dot gnu.org
@ 2024-01-02 17:59 ` ppalka at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: ppalka at gcc dot gnu.org @ 2024-01-02 17:59 UTC (permalink / raw)
  To: gcc-bugs

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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED

--- Comment #6 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Fixed for 11.5/12.4/13.3.

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

end of thread, other threads:[~2024-01-02 17:59 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-19 16:50 [Bug c++/111485] New: Constraint mismatch on template template parameter barry.revzin at gmail dot com
2023-09-19 17:29 ` [Bug c++/111485] [11/12/13/14 Regression] " ppalka at gcc dot gnu.org
2023-09-22 10:26 ` cvs-commit at gcc dot gnu.org
2023-09-24 18:42 ` cvs-commit at gcc dot gnu.org
2023-12-24 15:11 ` [Bug c++/111485] [11/12 " cvs-commit at gcc dot gnu.org
2023-12-24 15:12 ` cvs-commit at gcc dot gnu.org
2024-01-02 17:59 ` ppalka 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).