public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/102651] New: typeid(X**) instantiates X
@ 2021-10-08 15:03 pdimov at gmail dot com
  2021-10-08 18:55 ` [Bug c++/102651] [9/10/11/12 Regression] " pinskia at gcc dot gnu.org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: pdimov at gmail dot com @ 2021-10-08 15:03 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 102651
           Summary: typeid(X**) instantiates X
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pdimov at gmail dot com
  Target Milestone: ---

Using f.ex. `typeid(std:pair<void, void>**)` tries to instantiate
`std::pair<int, int>` and fails: https://godbolt.org/z/GhbYe3P8j

(One asterisk should be enough, but doesn't work either.)

The example without pair is

```
#include <typeinfo>

template <typename T>
struct S{
    T x;
};

void foo()
{
    typeid( S<void>** );
}
```

https://godbolt.org/z/nG3Kr3Te7

Interestingly, if `S` is incomplete, it works:

```
#include <typeinfo>

template <typename T>
struct S;

void foo()
{
    typeid( S<void>** );
}
```

https://godbolt.org/z/nK8b5n1qn

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

* [Bug c++/102651] [9/10/11/12 Regression] typeid(X**) instantiates X
  2021-10-08 15:03 [Bug c++/102651] New: typeid(X**) instantiates X pdimov at gmail dot com
@ 2021-10-08 18:55 ` pinskia at gcc dot gnu.org
  2021-10-08 19:15 ` pinskia at gcc dot gnu.org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-10-08 18:55 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid
            Summary|typeid(X**) instantiates X  |[9/10/11/12 Regression]
                   |                            |typeid(X**) instantiates X
   Target Milestone|---                         |9.5

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

* [Bug c++/102651] [9/10/11/12 Regression] typeid(X**) instantiates X
  2021-10-08 15:03 [Bug c++/102651] New: typeid(X**) instantiates X pdimov at gmail dot com
  2021-10-08 18:55 ` [Bug c++/102651] [9/10/11/12 Regression] " pinskia at gcc dot gnu.org
@ 2021-10-08 19:15 ` pinskia at gcc dot gnu.org
  2022-01-17 13:14 ` [Bug c++/102651] [9/10/11/12 Regression] typeid(X**) instantiates X caused by r0-109856 rguenth at gcc dot gnu.org
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-10-08 19:15 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2021-10-08
     Ever confirmed|0                           |1

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.  I thought I had saw another bug like this bug I can't seem to find
it.

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

* [Bug c++/102651] [9/10/11/12 Regression] typeid(X**) instantiates X caused by r0-109856
  2021-10-08 15:03 [Bug c++/102651] New: typeid(X**) instantiates X pdimov at gmail dot com
  2021-10-08 18:55 ` [Bug c++/102651] [9/10/11/12 Regression] " pinskia at gcc dot gnu.org
  2021-10-08 19:15 ` pinskia at gcc dot gnu.org
@ 2022-01-17 13:14 ` rguenth at gcc dot gnu.org
  2022-04-15 15:06 ` jason at gcc dot gnu.org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-01-17 13:14 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2

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

* [Bug c++/102651] [9/10/11/12 Regression] typeid(X**) instantiates X caused by r0-109856
  2021-10-08 15:03 [Bug c++/102651] New: typeid(X**) instantiates X pdimov at gmail dot com
                   ` (2 preceding siblings ...)
  2022-01-17 13:14 ` [Bug c++/102651] [9/10/11/12 Regression] typeid(X**) instantiates X caused by r0-109856 rguenth at gcc dot gnu.org
@ 2022-04-15 15:06 ` jason at gcc dot gnu.org
  2022-04-15 15:06 ` jason at gcc dot gnu.org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: jason at gcc dot gnu.org @ 2022-04-15 15:06 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jason at gcc dot gnu.org

--- Comment #2 from Jason Merrill <jason at gcc dot gnu.org> ---
Created attachment 52817
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52817&action=edit
fix

Here's a fix, but I'm going to hold it for stage 1, probably backport for 12.2
etc.

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

* [Bug c++/102651] [9/10/11/12 Regression] typeid(X**) instantiates X caused by r0-109856
  2021-10-08 15:03 [Bug c++/102651] New: typeid(X**) instantiates X pdimov at gmail dot com
                   ` (3 preceding siblings ...)
  2022-04-15 15:06 ` jason at gcc dot gnu.org
@ 2022-04-15 15:06 ` jason at gcc dot gnu.org
  2022-04-29  3:00 ` [Bug c++/102651] [9/10/11/12/13 " cvs-commit at gcc dot gnu.org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: jason at gcc dot gnu.org @ 2022-04-15 15:06 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

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

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

* [Bug c++/102651] [9/10/11/12/13 Regression] typeid(X**) instantiates X caused by r0-109856
  2021-10-08 15:03 [Bug c++/102651] New: typeid(X**) instantiates X pdimov at gmail dot com
                   ` (4 preceding siblings ...)
  2022-04-15 15:06 ` jason at gcc dot gnu.org
@ 2022-04-29  3:00 ` cvs-commit at gcc dot gnu.org
  2022-05-15 16:29 ` [Bug c++/102651] [9/10/11/12 " cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-04-29  3:00 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jason Merrill <jason@gcc.gnu.org>:

https://gcc.gnu.org/g:97b30a399ef561f6f37a2c08c830fdf3141bb504

commit r13-24-g97b30a399ef561f6f37a2c08c830fdf3141bb504
Author: Jason Merrill <jason@redhat.com>
Date:   Fri Apr 15 00:11:00 2022 -0400

    c++: typeid and instantiation [PR102651]

    PR49387 was a problem with initially asking for a typeid for a class
    template specialization before it was complete, and later actually filling
    in the descriptor when the class was complete, and thus disagreeing on the
    form of the descriptor.  I fixed that by forcing the class to be complete,
    but this testcase shows why that approach is problematic.  So instead let's
    adjust the type of the descriptor later if needed.

            PR c++/102651
            PR c++/49387

    gcc/cp/ChangeLog:

            * rtti.cc (get_tinfo_decl_direct): Don't complete_type.
            (emit_tinfo_decl): Update tdesc type if needed.

    gcc/testsuite/ChangeLog:

            * g++.dg/rtti/typeid-complete1.C: New test.

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

* [Bug c++/102651] [9/10/11/12 Regression] typeid(X**) instantiates X caused by r0-109856
  2021-10-08 15:03 [Bug c++/102651] New: typeid(X**) instantiates X pdimov at gmail dot com
                   ` (5 preceding siblings ...)
  2022-04-29  3:00 ` [Bug c++/102651] [9/10/11/12/13 " cvs-commit at gcc dot gnu.org
@ 2022-05-15 16:29 ` cvs-commit at gcc dot gnu.org
  2022-05-27  9:46 ` [Bug c++/102651] [10/11 " rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-05-15 16:29 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-12 branch has been updated by Jason Merrill
<jason@gcc.gnu.org>:

https://gcc.gnu.org/g:5237059e04d105fe5441fa7434699eea9a34bf1b

commit r12-8378-g5237059e04d105fe5441fa7434699eea9a34bf1b
Author: Jason Merrill <jason@redhat.com>
Date:   Fri Apr 15 00:11:00 2022 -0400

    c++: typeid and instantiation [PR102651]

    PR49387 was a problem with initially asking for a typeid for a class
    template specialization before it was complete, and later actually filling
    in the descriptor when the class was complete, and thus disagreeing on the
    form of the descriptor.  I fixed that by forcing the class to be complete,
    but this testcase shows why that approach is problematic.  So instead let's
    adjust the type of the descriptor later if needed.

            PR c++/102651
            PR c++/49387

    gcc/cp/ChangeLog:

            * rtti.cc (get_tinfo_decl_direct): Don't complete_type.
            (emit_tinfo_decl): Update tdesc type if needed.

    gcc/testsuite/ChangeLog:

            * g++.dg/rtti/typeid-complete1.C: New test.

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

* [Bug c++/102651] [10/11 Regression] typeid(X**) instantiates X caused by r0-109856
  2021-10-08 15:03 [Bug c++/102651] New: typeid(X**) instantiates X pdimov at gmail dot com
                   ` (6 preceding siblings ...)
  2022-05-15 16:29 ` [Bug c++/102651] [9/10/11/12 " cvs-commit at gcc dot gnu.org
@ 2022-05-27  9:46 ` rguenth at gcc dot gnu.org
  2022-06-28 10:46 ` jakub at gcc dot gnu.org
  2023-07-07 10:41 ` [Bug c++/102651] [11 " rguenth at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-05-27  9:46 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|9.5                         |10.4

--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 9 branch is being closed

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

* [Bug c++/102651] [10/11 Regression] typeid(X**) instantiates X caused by r0-109856
  2021-10-08 15:03 [Bug c++/102651] New: typeid(X**) instantiates X pdimov at gmail dot com
                   ` (7 preceding siblings ...)
  2022-05-27  9:46 ` [Bug c++/102651] [10/11 " rguenth at gcc dot gnu.org
@ 2022-06-28 10:46 ` jakub at gcc dot gnu.org
  2023-07-07 10:41 ` [Bug c++/102651] [11 " rguenth at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-06-28 10:46 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|10.4                        |10.5

--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 10.4 is being released, retargeting bugs to GCC 10.5.

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

* [Bug c++/102651] [11 Regression] typeid(X**) instantiates X caused by r0-109856
  2021-10-08 15:03 [Bug c++/102651] New: typeid(X**) instantiates X pdimov at gmail dot com
                   ` (8 preceding siblings ...)
  2022-06-28 10:46 ` jakub at gcc dot gnu.org
@ 2023-07-07 10:41 ` rguenth at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-07-07 10:41 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|10.5                        |11.5

--- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 10 branch is being closed.

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

end of thread, other threads:[~2023-07-07 10:41 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-08 15:03 [Bug c++/102651] New: typeid(X**) instantiates X pdimov at gmail dot com
2021-10-08 18:55 ` [Bug c++/102651] [9/10/11/12 Regression] " pinskia at gcc dot gnu.org
2021-10-08 19:15 ` pinskia at gcc dot gnu.org
2022-01-17 13:14 ` [Bug c++/102651] [9/10/11/12 Regression] typeid(X**) instantiates X caused by r0-109856 rguenth at gcc dot gnu.org
2022-04-15 15:06 ` jason at gcc dot gnu.org
2022-04-15 15:06 ` jason at gcc dot gnu.org
2022-04-29  3:00 ` [Bug c++/102651] [9/10/11/12/13 " cvs-commit at gcc dot gnu.org
2022-05-15 16:29 ` [Bug c++/102651] [9/10/11/12 " cvs-commit at gcc dot gnu.org
2022-05-27  9:46 ` [Bug c++/102651] [10/11 " rguenth at gcc dot gnu.org
2022-06-28 10:46 ` jakub at gcc dot gnu.org
2023-07-07 10:41 ` [Bug c++/102651] [11 " rguenth 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).