public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/101883] New: class template argument deduction in non-type template parameter allows explicit deduction guide
@ 2021-08-12 15:29 barry.revzin at gmail dot com
  2021-08-12 18:04 ` [Bug c++/101883] " ppalka at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: barry.revzin at gmail dot com @ 2021-08-12 15:29 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 101883
           Summary: class template argument deduction in non-type template
                    parameter allows explicit deduction guide
           Product: gcc
           Version: 10.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 example:

template <class T> struct C { constexpr C(int) {} };
explicit C(int) -> C<int>;

template <C c> struct X { };
X<1> x;

This should fail to compile, because the deduction guide is explicit and so
should not be a candidate, but gcc accepts this example.

gcc does correctly reject:

C y = 1;

Which is the same kind of thing.

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

* [Bug c++/101883] class template argument deduction in non-type template parameter allows explicit deduction guide
  2021-08-12 15:29 [Bug c++/101883] New: class template argument deduction in non-type template parameter allows explicit deduction guide barry.revzin at gmail dot com
@ 2021-08-12 18:04 ` ppalka at gcc dot gnu.org
  2021-08-18 12:39 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: ppalka at gcc dot gnu.org @ 2021-08-12 18:04 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2021-08-12
           Assignee|unassigned at gcc dot gnu.org      |ppalka at gcc dot gnu.org
                 CC|                            |ppalka at gcc dot gnu.org
     Ever confirmed|0                           |1

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

* [Bug c++/101883] class template argument deduction in non-type template parameter allows explicit deduction guide
  2021-08-12 15:29 [Bug c++/101883] New: class template argument deduction in non-type template parameter allows explicit deduction guide barry.revzin at gmail dot com
  2021-08-12 18:04 ` [Bug c++/101883] " ppalka at gcc dot gnu.org
@ 2021-08-18 12:39 ` cvs-commit at gcc dot gnu.org
  2021-10-06 14:15 ` cvs-commit at gcc dot gnu.org
  2021-10-06 14:16 ` ppalka at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-08-18 12:39 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 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:a6b3db3e8625a3cba1240f0b5e1a29bd6c68b8ca

commit r12-2990-ga6b3db3e8625a3cba1240f0b5e1a29bd6c68b8ca
Author: Patrick Palka <ppalka@redhat.com>
Date:   Wed Aug 18 08:37:42 2021 -0400

    c++: ignore explicit dguides during NTTP CTAD [PR101883]

    Since (template) argument passing is a copy-initialization context,
    we mustn't consider explicit deduction guides when deducing a CTAD
    placeholder type of an NTTP.

            PR c++/101883

    gcc/cp/ChangeLog:

            * pt.c (convert_template_argument): Pass LOOKUP_IMPLICIT to
            do_auto_deduction.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp2a/nontype-class49.C: New test.

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

* [Bug c++/101883] class template argument deduction in non-type template parameter allows explicit deduction guide
  2021-08-12 15:29 [Bug c++/101883] New: class template argument deduction in non-type template parameter allows explicit deduction guide barry.revzin at gmail dot com
  2021-08-12 18:04 ` [Bug c++/101883] " ppalka at gcc dot gnu.org
  2021-08-18 12:39 ` cvs-commit at gcc dot gnu.org
@ 2021-10-06 14:15 ` cvs-commit at gcc dot gnu.org
  2021-10-06 14:16 ` ppalka at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-10-06 14:15 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from CVS 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:52dd840c5eba25ef54dee3f1c78f371032a7c051

commit r11-9078-g52dd840c5eba25ef54dee3f1c78f371032a7c051
Author: Patrick Palka <ppalka@redhat.com>
Date:   Wed Aug 18 08:37:42 2021 -0400

    c++: ignore explicit dguides during NTTP CTAD [PR101883]

    Since (template) argument passing is a copy-initialization context,
    we mustn't consider explicit deduction guides when deducing a CTAD
    placeholder type of an NTTP.

            PR c++/101883

    gcc/cp/ChangeLog:

            * pt.c (convert_template_argument): Pass LOOKUP_IMPLICIT to
            do_auto_deduction.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp2a/nontype-class49.C: New test.

    (cherry picked from commit a6b3db3e8625a3cba1240f0b5e1a29bd6c68b8ca)

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

* [Bug c++/101883] class template argument deduction in non-type template parameter allows explicit deduction guide
  2021-08-12 15:29 [Bug c++/101883] New: class template argument deduction in non-type template parameter allows explicit deduction guide barry.revzin at gmail dot com
                   ` (2 preceding siblings ...)
  2021-10-06 14:15 ` cvs-commit at gcc dot gnu.org
@ 2021-10-06 14:16 ` ppalka at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: ppalka at gcc dot gnu.org @ 2021-10-06 14:16 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #3 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Fixed for GCC 11.3 and 12.

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

end of thread, other threads:[~2021-10-06 14:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-12 15:29 [Bug c++/101883] New: class template argument deduction in non-type template parameter allows explicit deduction guide barry.revzin at gmail dot com
2021-08-12 18:04 ` [Bug c++/101883] " ppalka at gcc dot gnu.org
2021-08-18 12:39 ` cvs-commit at gcc dot gnu.org
2021-10-06 14:15 ` cvs-commit at gcc dot gnu.org
2021-10-06 14:16 ` 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).