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

            Bug ID: 116108
           Summary: GCC crashes on incorrect code with -std=c++20
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: q1210081098 at gmail dot com
  Target Milestone: ---

Reproducer: https://gcc.godbolt.org/z/37KzjK5T7

```cpp

#include <iostream>
namespace std
{
    template<class T>
    class size_t_class {
    public:
        typedef std::uintptr value_type;
        const size_t_class value = 1;
        constexpr bool operator == (size_t_class u) const { return true; }

        template<class U> constexpr operator U()
        {
            return static_cast<U>(value);
        }
    };
}
struct Point3 {
    std::size_t_class x = 0;
    std::size_t_class y = 0;
};
int main() {
    Point3 p = {4, std::size_t_class{2}};
    p.x = 10;
    return p.y<<'\n' ;
}
```
and get the error information
```
<source>:7:22: error: 'uintptr' in namespace 'std' does not name a type
    7 |         typedef std::uintptr value_type;
      |                      ^~~~~~~
<source>:18:5: error: invalid use of template-name 'std::size_t_class' without
an argument list
   18 |     std::size_t_class x = 0;
      |     ^~~
<source>:19:5: error: invalid use of template-name 'std::size_t_class' without
an argument list
   19 |     std::size_t_class y = 0;
      |     ^~~
g++: internal compiler error: Segmentation fault signal terminated program
cc1plus
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
See <https://gcc.gnu.org/bugs/> for instructions.
Compiler returned: 4
```

Reply via email to