public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/96164] New: Constraints and explicit template instantiation
@ 2020-07-11  9:01 jaahans2 at gmail dot com
  2020-07-11  9:04 ` [Bug c++/96164] " jaahans2 at gmail dot com
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: jaahans2 at gmail dot com @ 2020-07-11  9:01 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 96164
           Summary: Constraints and explicit template instantiation
           Product: gcc
           Version: 10.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jaahans2 at gmail dot com
  Target Milestone: ---

The following code does not compile in all of gcc 10.1, msvc 19.24, and clang
10.0.0:

    template <int N>
    struct A {
        void g() requires (N == 3) {}
        void f() requires (N == 3) { g(); }
    };

    template struct A<2>;

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

* [Bug c++/96164] Constraints and explicit template instantiation
  2020-07-11  9:01 [Bug c++/96164] New: Constraints and explicit template instantiation jaahans2 at gmail dot com
@ 2020-07-11  9:04 ` jaahans2 at gmail dot com
  2020-07-11 16:46 ` ppalka at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jaahans2 at gmail dot com @ 2020-07-11  9:04 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from kaba <jaahans2 at gmail dot com> ---
The error is "use of function 'void A<N>::g() requires  N == 3 [with int N =
2]' with unsatisfied constraints"

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

* [Bug c++/96164] Constraints and explicit template instantiation
  2020-07-11  9:01 [Bug c++/96164] New: Constraints and explicit template instantiation jaahans2 at gmail dot com
  2020-07-11  9:04 ` [Bug c++/96164] " jaahans2 at gmail dot com
@ 2020-07-11 16:46 ` ppalka at gcc dot gnu.org
  2020-07-11 16:47 ` ppalka at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: ppalka at gcc dot gnu.org @ 2020-07-11 16:46 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2020-07-11
                 CC|                            |ppalka at gcc dot gnu.org

--- Comment #2 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Confirmed.  [temp.explicit]/11 says:

An explicit instantiation that names a class template specialization is also an
explicit instantiation of the same kind (declaration or definition) of each of
its members (not including members inherited from base classes and members that
are templates) that has not been previously explicitly specialized in the
translation unit containing the explicit instantiation, ***provided that the
associated constraints, if any, of that member are satisfied by the template
arguments of the explicit instantiation*** ...

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

* [Bug c++/96164] Constraints and explicit template instantiation
  2020-07-11  9:01 [Bug c++/96164] New: Constraints and explicit template instantiation jaahans2 at gmail dot com
  2020-07-11  9:04 ` [Bug c++/96164] " jaahans2 at gmail dot com
  2020-07-11 16:46 ` ppalka at gcc dot gnu.org
@ 2020-07-11 16:47 ` ppalka at gcc dot gnu.org
  2020-07-30  2:15 ` cvs-commit at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: ppalka at gcc dot gnu.org @ 2020-07-11 16:47 UTC (permalink / raw)
  To: gcc-bugs

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

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

--- Comment #3 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Another testcase:

   template <int N>
   struct A {
       void f() requires (N == 3) { static_assert(N == 3); }
   };

   template struct A<2>;

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

* [Bug c++/96164] Constraints and explicit template instantiation
  2020-07-11  9:01 [Bug c++/96164] New: Constraints and explicit template instantiation jaahans2 at gmail dot com
                   ` (2 preceding siblings ...)
  2020-07-11 16:47 ` ppalka at gcc dot gnu.org
@ 2020-07-30  2:15 ` cvs-commit at gcc dot gnu.org
  2020-08-11  2:36 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-07-30  2:15 UTC (permalink / raw)
  To: gcc-bugs

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

--- 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:dc3d1e181445fafbbd146eb355a750c41c338794

commit r11-2417-gdc3d1e181445fafbbd146eb355a750c41c338794
Author: Patrick Palka <ppalka@redhat.com>
Date:   Wed Jul 29 22:06:33 2020 -0400

    c++: constraints and explicit instantiation [PR96164]

    When considering to instantiate a member of a class template as part of
    an explicit instantiation of the class template, we need to first check
    the member's constraints before proceeding with the instantiation of the
    member.

    gcc/cp/ChangeLog:

            PR c++/96164
            * constraint.cc (constraints_satisfied_p): Return true if
            !flags_concepts.
            * pt.c (do_type_instantiation): Update a paragraph taken from
            [temp.explicit] to reflect the latest specification.  Don't
            instantiate a member with unsatisfied constraints.

    gcc/testsuite/ChangeLog:

            PR c++/96164
            * g++.dg/cpp2a/concepts-explicit-inst5.C: New test.

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

* [Bug c++/96164] Constraints and explicit template instantiation
  2020-07-11  9:01 [Bug c++/96164] New: Constraints and explicit template instantiation jaahans2 at gmail dot com
                   ` (3 preceding siblings ...)
  2020-07-30  2:15 ` cvs-commit at gcc dot gnu.org
@ 2020-08-11  2:36 ` cvs-commit at gcc dot gnu.org
  2020-08-11  2:39 ` ppalka at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-08-11  2:36 UTC (permalink / raw)
  To: gcc-bugs

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

--- 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:215927a736d21d8cff8baeb50f687911a00149b9

commit r10-8602-g215927a736d21d8cff8baeb50f687911a00149b9
Author: Patrick Palka <ppalka@redhat.com>
Date:   Wed Jul 29 22:06:33 2020 -0400

    c++: constraints and explicit instantiation [PR96164]

    When considering to instantiate a member of a class template as part of
    an explicit instantiation of the class template, we need to first check
    the member's constraints before proceeding with the instantiation of the
    member.

    gcc/cp/ChangeLog:

            PR c++/96164
            * constraint.cc (constraints_satisfied_p): Return true if
            !flags_concepts.
            * pt.c (do_type_instantiation): Update a paragraph taken from
            [temp.explicit] to reflect the latest specification.  Don't
            instantiate a member with unsatisfied constraints.

    gcc/testsuite/ChangeLog:

            PR c++/96164
            * g++.dg/cpp2a/concepts-explicit-inst5.C: New test.

    (cherry picked from commit dc3d1e181445fafbbd146eb355a750c41c338794)

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

* [Bug c++/96164] Constraints and explicit template instantiation
  2020-07-11  9:01 [Bug c++/96164] New: Constraints and explicit template instantiation jaahans2 at gmail dot com
                   ` (4 preceding siblings ...)
  2020-08-11  2:36 ` cvs-commit at gcc dot gnu.org
@ 2020-08-11  2:39 ` ppalka at gcc dot gnu.org
  2021-11-11 22:25 ` pinskia at gcc dot gnu.org
  2023-03-15 13:25 ` ppalka at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: ppalka at gcc dot gnu.org @ 2020-08-11  2:39 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #6 from Patrick Palka <ppalka at gcc dot gnu.org> ---
This should be fixed for GCC 10.3+, thanks for the report.

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

* [Bug c++/96164] Constraints and explicit template instantiation
  2020-07-11  9:01 [Bug c++/96164] New: Constraints and explicit template instantiation jaahans2 at gmail dot com
                   ` (5 preceding siblings ...)
  2020-08-11  2:39 ` ppalka at gcc dot gnu.org
@ 2021-11-11 22:25 ` pinskia at gcc dot gnu.org
  2023-03-15 13:25 ` ppalka at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-11-11 22:25 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |akrzemi1 at gmail dot com

--- Comment #7 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 77595 has been marked as a duplicate of this bug. ***

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

* [Bug c++/96164] Constraints and explicit template instantiation
  2020-07-11  9:01 [Bug c++/96164] New: Constraints and explicit template instantiation jaahans2 at gmail dot com
                   ` (6 preceding siblings ...)
  2021-11-11 22:25 ` pinskia at gcc dot gnu.org
@ 2023-03-15 13:25 ` ppalka at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: ppalka at gcc dot gnu.org @ 2023-03-15 13:25 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ryan.burn at gmail dot com

--- Comment #8 from Patrick Palka <ppalka at gcc dot gnu.org> ---
*** Bug 68608 has been marked as a duplicate of this bug. ***

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

end of thread, other threads:[~2023-03-15 13:25 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-11  9:01 [Bug c++/96164] New: Constraints and explicit template instantiation jaahans2 at gmail dot com
2020-07-11  9:04 ` [Bug c++/96164] " jaahans2 at gmail dot com
2020-07-11 16:46 ` ppalka at gcc dot gnu.org
2020-07-11 16:47 ` ppalka at gcc dot gnu.org
2020-07-30  2:15 ` cvs-commit at gcc dot gnu.org
2020-08-11  2:36 ` cvs-commit at gcc dot gnu.org
2020-08-11  2:39 ` ppalka at gcc dot gnu.org
2021-11-11 22:25 ` pinskia at gcc dot gnu.org
2023-03-15 13:25 ` 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).