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

Reply via email to