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

            Bug ID: 127708
           Summary: -Wint-to-pointer-cast warning from requires clause of
                    overload that isn't selected
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: eczbek.void at gmail dot com
  Target Milestone: ---

https://godbolt.org/z/W9KT13oGa
Clang and MSVC don't warn about this

```
void f(auto x) requires requires { (int*)x; } {}

void f(auto) {}

int main() {
        f(0);
}
```

```
<source>: In substitution of 'template<class auto:1> void f(auto:1) requires
requires{int*(x);} [with auto:1 = int]':
<source>:6:3:   required from here
    6 |         f(0);
      |         ~^~~
<source>:1:36: warning: cast to pointer from integer of different size
[-Wint-to-pointer-cast]
    1 | void f(auto x) requires requires { (int*)x; } {}
      |                                    ^~~~~~~
```

Reply via email to