public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/92103] constraints not checked on nested class template
       [not found] <bug-92103-4@http.gcc.gnu.org/bugzilla/>
@ 2020-06-02 19:15 ` ppalka at gcc dot gnu.org
  2020-06-03 20:41 ` cvs-commit at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 6+ messages in thread
From: ppalka at gcc dot gnu.org @ 2020-06-02 19:15 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |ppalka at gcc dot gnu.org
             Status|NEW                         |ASSIGNED
                 CC|                            |ppalka at gcc dot gnu.org

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

* [Bug c++/92103] constraints not checked on nested class template
       [not found] <bug-92103-4@http.gcc.gnu.org/bugzilla/>
  2020-06-02 19:15 ` [Bug c++/92103] constraints not checked on nested class template ppalka at gcc dot gnu.org
@ 2020-06-03 20:41 ` cvs-commit at gcc dot gnu.org
  2020-06-04 17:21 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-06-03 20:41 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 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:aee69073cdb8086d393f12474c6177e75467ceaa

commit r11-884-gaee69073cdb8086d393f12474c6177e75467ceaa
Author: Patrick Palka <ppalka@redhat.com>
Date:   Wed Jun 3 16:40:28 2020 -0400

    c++: constrained nested partial specialization [PR92103]

    When determining the most specialized partial specialization of a
    primary template that is nested inside a class template, we first
    tsubst the outer template arguments into the TEMPLATE_DECL of each
    partial specialization, and then check for satisfaction of each of the
    new TEMPLATE_DECL's constraints.

    But tsubst_template_decl does not currently guarantee that constraints
    from the original DECL_TEMPLATE_RESULT get reattached to the new
    DECL_TEMPLATE_RESULT.  In the testcase below, this leads to the
    constraints_satisfied_p check in most_specialized_partial_spec to
    trivially return true for each of the partial specializations.

    I'm not sure if such a guarantee would be desirable, but in this case we
    can just check constraints_satisfied_p on the original TEMPLATE_DECL
    instead of on the tsubsted TEMPLATE_DECL here, which is what this patch
    does (alongside some reorganizing).

    gcc/cp/ChangeLog:

            PR c++/92103
            * pt.c (most_specialized_partial_spec): Reorganize the loop over
            DECL_TEMPLATE_SPECIALIZATIONS.  Check constraints_satisfied_p on
            the original template declaration, not on the tsubsted one.

    gcc/testsuite/ChangeLog:

            PR c++/92103
            * g++.dg/cpp2a/concepts-partial-spec7.C: New test.

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

* [Bug c++/92103] constraints not checked on nested class template
       [not found] <bug-92103-4@http.gcc.gnu.org/bugzilla/>
  2020-06-02 19:15 ` [Bug c++/92103] constraints not checked on nested class template ppalka at gcc dot gnu.org
  2020-06-03 20:41 ` cvs-commit at gcc dot gnu.org
@ 2020-06-04 17:21 ` cvs-commit at gcc dot gnu.org
  2020-06-04 17:22 ` ppalka at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-06-04 17:21 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

commit r10-8228-ga3a71447513cd6aee06631e1cc73a530e2c7fd95
Author: Patrick Palka <ppalka@redhat.com>
Date:   Thu Jun 4 13:03:58 2020 -0400

    c++: constrained nested partial specialization [PR92103]

    When determining the most specialized partial specialization of a
    primary template that is nested inside a class template, we first
    tsubst the outer template arguments into the TEMPLATE_DECL of each
    partial specialization, and then check for satisfaction of each of the
    new TEMPLATE_DECL's constraints.

    But tsubst_template_decl does not currently guarantee that constraints
    from the original DECL_TEMPLATE_RESULT get reattached to the new
    DECL_TEMPLATE_RESULT.  In the testcase below, this leads to the
    constraints_satisfied_p check in most_specialized_partial_spec to
    trivially return true for each of the partial specializations.

    I'm not sure if such a guarantee would be desirable, but in this case we
    can just check constraints_satisfied_p on the original TEMPLATE_DECL
    instead of on the tsubsted TEMPLATE_DECL here, which is what this patch
    does (alongside some reorganizing).

    gcc/cp/ChangeLog:

            PR c++/92103
            * pt.c (most_specialized_partial_spec): Reorganize the loop over
            DECL_TEMPLATE_SPECIALIZATIONS.  Check constraints_satisfied_p on
            the original template declaration, not on the tsubsted one.

    gcc/testsuite/ChangeLog:

            PR c++/92103
            * g++.dg/cpp2a/concepts-partial-spec7.C: New test.

    (cherry picked from commit aee69073cdb8086d393f12474c6177e75467ceaa)

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

* [Bug c++/92103] constraints not checked on nested class template
       [not found] <bug-92103-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2020-06-04 17:21 ` cvs-commit at gcc dot gnu.org
@ 2020-06-04 17:22 ` ppalka at gcc dot gnu.org
  2020-06-04 22:34 ` cvs-commit at gcc dot gnu.org
  2020-11-25 18:10 ` cvs-commit at gcc dot gnu.org
  5 siblings, 0 replies; 6+ messages in thread
From: ppalka at gcc dot gnu.org @ 2020-06-04 17:22 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED
   Target Milestone|---                         |10.2

--- Comment #6 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Fixed for GCC 10.2+.

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

* [Bug c++/92103] constraints not checked on nested class template
       [not found] <bug-92103-4@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2020-06-04 17:22 ` ppalka at gcc dot gnu.org
@ 2020-06-04 22:34 ` cvs-commit at gcc dot gnu.org
  2020-11-25 18:10 ` cvs-commit at gcc dot gnu.org
  5 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-06-04 22:34 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jonathan Wakely <redi@gcc.gnu.org>:

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

commit r11-960-gf2242ec0d3f1bb13c78ef3c21e0354d84fe57222
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Thu Jun 4 23:20:49 2020 +0100

    libstdc++: Remove workarounds for constrained nested class templates

    With PR c++/92078 and PR c++/92103 both fixed, nested class templates
    can now be constrained. That means a number of namespace-scope helpers
    can be moved to the class scope, so they're only visible where they're
    needed.

            * include/bits/iterator_concepts.h (__detail::__ptr,
__detail::__ref)
            (__detail::__cat, __detail::__diff): Move to class scope in the
            relevant __iterator_traits specializations.
            (__iterator_traits<>): Use nested class templates instead of ones
from
            namespace __detail.
            * include/bits/stl_iterator.h (__detail::__common_iter_ptr): Move
to
            class scope in iterator_traits<common_iterator<I, S>>.
            (iterator_traits<common_iterator<I, S>>): Use nested class template
            instead of __detail::__common_iter_ptr.

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

* [Bug c++/92103] constraints not checked on nested class template
       [not found] <bug-92103-4@http.gcc.gnu.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2020-06-04 22:34 ` cvs-commit at gcc dot gnu.org
@ 2020-11-25 18:10 ` cvs-commit at gcc dot gnu.org
  5 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-11-25 18:10 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Jonathan Wakely
<redi@gcc.gnu.org>:

https://gcc.gnu.org/g:2fe01dcd25d29798510101303b5bbfc254003b18

commit r10-9080-g2fe01dcd25d29798510101303b5bbfc254003b18
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Thu Jun 4 23:20:49 2020 +0100

    libstdc++: Remove workarounds for constrained nested class templates

    With PR c++/92078 and PR c++/92103 both fixed, nested class templates
    can now be constrained. That means a number of namespace-scope helpers
    can be moved to the class scope, so they're only visible where they're
    needed.

            * include/bits/iterator_concepts.h (__detail::__ptr,
__detail::__ref)
            (__detail::__cat, __detail::__diff): Move to class scope in the
            relevant __iterator_traits specializations.
            (__iterator_traits<>): Use nested class templates instead of ones
from
            namespace __detail.
            * include/bits/stl_iterator.h (__detail::__common_iter_ptr): Move
to
            class scope in iterator_traits<common_iterator<I, S>>.
            (iterator_traits<common_iterator<I, S>>): Use nested class template
            instead of __detail::__common_iter_ptr.

    (cherry picked from commit f2242ec0d3f1bb13c78ef3c21e0354d84fe57222)

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

end of thread, other threads:[~2020-11-25 18:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-92103-4@http.gcc.gnu.org/bugzilla/>
2020-06-02 19:15 ` [Bug c++/92103] constraints not checked on nested class template ppalka at gcc dot gnu.org
2020-06-03 20:41 ` cvs-commit at gcc dot gnu.org
2020-06-04 17:21 ` cvs-commit at gcc dot gnu.org
2020-06-04 17:22 ` ppalka at gcc dot gnu.org
2020-06-04 22:34 ` cvs-commit at gcc dot gnu.org
2020-11-25 18:10 ` cvs-commit 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).