public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/104074] New: [12 Regression] Maybe rejected code: is not a valid type for a template non-type parameter since r12-6022-gbb2a7f80a98de3fe
@ 2022-01-17 21:44 marxin at gcc dot gnu.org
  2022-01-17 21:48 ` [Bug c++/104074] [12 Regression] [c++17] " pinskia at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-01-17 21:44 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 104074
           Summary: [12 Regression] Maybe rejected code: is not a valid
                    type for a template non-type parameter since
                    r12-6022-gbb2a7f80a98de3fe
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: marxin at gcc dot gnu.org
                CC: ppalka at gcc dot gnu.org
  Target Milestone: ---

The following test-case is isolated from libreoffice:

$ cat x.ii
template <auto> class gr_sp;
template <typename T> using gr_rp = gr_sp<&T::recycle>;

$ g++ x.ii -c
x.ii:2:54: error: ‘‘dependent_operator_type’ not supported by dump_type<type
error>’ is not a valid type for a template non-type parameter
    2 | template <typename T> using gr_rp = gr_sp<&T::recycle>;
      |                                                      ^

clang accepts the code snippet

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

* [Bug c++/104074] [12 Regression] [c++17] Maybe rejected code: is not a valid type for a template non-type parameter since r12-6022-gbb2a7f80a98de3fe
  2022-01-17 21:44 [Bug c++/104074] New: [12 Regression] Maybe rejected code: is not a valid type for a template non-type parameter since r12-6022-gbb2a7f80a98de3fe marxin at gcc dot gnu.org
@ 2022-01-17 21:48 ` pinskia at gcc dot gnu.org
  2022-01-17 21:53 ` pinskia at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-01-17 21:48 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |12.0
   Last reconfirmed|                            |2022-01-17
             Status|UNCONFIRMED                 |NEW
            Summary|[12 Regression] Maybe       |[12 Regression] [c++17]
                   |rejected code: is not a     |Maybe rejected code: is not
                   |valid type for a template   |a valid type for a template
                   |non-type parameter since    |non-type parameter since
                   |r12-6022-gbb2a7f80a98de3fe  |r12-6022-gbb2a7f80a98de3fe
     Ever confirmed|0                           |1

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I think it is valid too. GCC does accept it for -std=c++20 but not for
-std=c++17 .

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

* [Bug c++/104074] [12 Regression] [c++17] Maybe rejected code: is not a valid type for a template non-type parameter since r12-6022-gbb2a7f80a98de3fe
  2022-01-17 21:44 [Bug c++/104074] New: [12 Regression] Maybe rejected code: is not a valid type for a template non-type parameter since r12-6022-gbb2a7f80a98de3fe marxin at gcc dot gnu.org
  2022-01-17 21:48 ` [Bug c++/104074] [12 Regression] [c++17] " pinskia at gcc dot gnu.org
@ 2022-01-17 21:53 ` pinskia at gcc dot gnu.org
  2022-01-17 22:41 ` pinskia at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-01-17 21:53 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
The following are accepted:
struct f;

template <void (f::*)(void)> class pfm;
template <typename T> using u0 = pfm<&T::recycle>;
template <int f::*> class pmv;
template <typename T> using u1= pmv<&T::recycle>;
template <int*> class ptr;
template <typename T> using u2= ptr<&T::recycle>;

So I don't see why auto would be special not accepting this here.

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

* [Bug c++/104074] [12 Regression] [c++17] Maybe rejected code: is not a valid type for a template non-type parameter since r12-6022-gbb2a7f80a98de3fe
  2022-01-17 21:44 [Bug c++/104074] New: [12 Regression] Maybe rejected code: is not a valid type for a template non-type parameter since r12-6022-gbb2a7f80a98de3fe marxin at gcc dot gnu.org
  2022-01-17 21:48 ` [Bug c++/104074] [12 Regression] [c++17] " pinskia at gcc dot gnu.org
  2022-01-17 21:53 ` pinskia at gcc dot gnu.org
@ 2022-01-17 22:41 ` pinskia at gcc dot gnu.org
  2022-01-18  5:17 ` pinskia at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-01-17 22:41 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |linux at carewolf dot com

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

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

* [Bug c++/104074] [12 Regression] [c++17] Maybe rejected code: is not a valid type for a template non-type parameter since r12-6022-gbb2a7f80a98de3fe
  2022-01-17 21:44 [Bug c++/104074] New: [12 Regression] Maybe rejected code: is not a valid type for a template non-type parameter since r12-6022-gbb2a7f80a98de3fe marxin at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2022-01-17 22:41 ` pinskia at gcc dot gnu.org
@ 2022-01-18  5:17 ` pinskia at gcc dot gnu.org
  2022-01-18  7:29 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-01-18  5:17 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=51577

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Martin Liška from comment #0)
> The following test-case is isolated from libreoffice:

Note QT/chromium has the same code even as it comes from skia.

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

* [Bug c++/104074] [12 Regression] [c++17] Maybe rejected code: is not a valid type for a template non-type parameter since r12-6022-gbb2a7f80a98de3fe
  2022-01-17 21:44 [Bug c++/104074] New: [12 Regression] Maybe rejected code: is not a valid type for a template non-type parameter since r12-6022-gbb2a7f80a98de3fe marxin at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2022-01-18  5:17 ` pinskia at gcc dot gnu.org
@ 2022-01-18  7:29 ` rguenth at gcc dot gnu.org
  2022-01-18 13:54 ` ppalka at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-01-18  7:29 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P1

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

* [Bug c++/104074] [12 Regression] [c++17] Maybe rejected code: is not a valid type for a template non-type parameter since r12-6022-gbb2a7f80a98de3fe
  2022-01-17 21:44 [Bug c++/104074] New: [12 Regression] Maybe rejected code: is not a valid type for a template non-type parameter since r12-6022-gbb2a7f80a98de3fe marxin at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2022-01-18  7:29 ` rguenth at gcc dot gnu.org
@ 2022-01-18 13:54 ` ppalka at gcc dot gnu.org
  2022-01-18 19:50 ` cvs-commit at gcc dot gnu.org
  2022-01-18 19:51 ` ppalka at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: ppalka at gcc dot gnu.org @ 2022-01-18 13:54 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

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

* [Bug c++/104074] [12 Regression] [c++17] Maybe rejected code: is not a valid type for a template non-type parameter since r12-6022-gbb2a7f80a98de3fe
  2022-01-17 21:44 [Bug c++/104074] New: [12 Regression] Maybe rejected code: is not a valid type for a template non-type parameter since r12-6022-gbb2a7f80a98de3fe marxin at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2022-01-18 13:54 ` ppalka at gcc dot gnu.org
@ 2022-01-18 19:50 ` cvs-commit at gcc dot gnu.org
  2022-01-18 19:51 ` ppalka at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-01-18 19:50 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 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:3c4a54adb2164315d18fd8980c0fc37eb3d22252

commit r12-6697-g3c4a54adb2164315d18fd8980c0fc37eb3d22252
Author: Patrick Palka <ppalka@redhat.com>
Date:   Tue Jan 18 14:50:06 2022 -0500

    c++: DEPENDENT_OPERATOR_TYPE as type of NTTP [PR104074]

    We're incorrectly rejecting the below testcase during template argument
    coercion because invalid_nontype_parm_type_p returns true for
    DEPENDENT_OPERATOR_TYPE in C++17 mode.

    This patch fixes this by partially rewriting invalid_nontype_parm_type_p
    in terms of WILDCARD_TYPE_P, for which DEPENDENT_OPERATOR_TYPE is true,
    so that the predicate handles wildcard types consistently.

            PR c++/104074

    gcc/cp/ChangeLog:

            * pt.cc (invalid_nontype_parm_type_p): Use WILDCARD_TYPE_P so
            that we return false for DEPENDENT_OPERATOR_TYPE too.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp1z/nontype-auto20.C: New test.

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

* [Bug c++/104074] [12 Regression] [c++17] Maybe rejected code: is not a valid type for a template non-type parameter since r12-6022-gbb2a7f80a98de3fe
  2022-01-17 21:44 [Bug c++/104074] New: [12 Regression] Maybe rejected code: is not a valid type for a template non-type parameter since r12-6022-gbb2a7f80a98de3fe marxin at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2022-01-18 19:50 ` cvs-commit at gcc dot gnu.org
@ 2022-01-18 19:51 ` ppalka at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: ppalka at gcc dot gnu.org @ 2022-01-18 19:51 UTC (permalink / raw)
  To: gcc-bugs

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

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.

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

end of thread, other threads:[~2022-01-18 19:51 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-17 21:44 [Bug c++/104074] New: [12 Regression] Maybe rejected code: is not a valid type for a template non-type parameter since r12-6022-gbb2a7f80a98de3fe marxin at gcc dot gnu.org
2022-01-17 21:48 ` [Bug c++/104074] [12 Regression] [c++17] " pinskia at gcc dot gnu.org
2022-01-17 21:53 ` pinskia at gcc dot gnu.org
2022-01-17 22:41 ` pinskia at gcc dot gnu.org
2022-01-18  5:17 ` pinskia at gcc dot gnu.org
2022-01-18  7:29 ` rguenth at gcc dot gnu.org
2022-01-18 13:54 ` ppalka at gcc dot gnu.org
2022-01-18 19:50 ` cvs-commit at gcc dot gnu.org
2022-01-18 19:51 ` 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).