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

            Bug ID: 125272
           Summary: GCC rejects valid program with associated constraints
                    on ctor
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jlame646 at gmail dot com
  Target Milestone: ---

The following valid program is rejected by clang and gcc but accepted by msvc.
https://godbolt.org/z/GnYd3cn91
```
#include <concepts>

template <typename T>
class A {
    A(A<void>) requires (!std::same_as<void, T>){}
};

```
GCC says:
```
<source>: In instantiation of 'class A<void>':
<source>:5:49:   required from here
    5 |     A(A<void>) requires (!std::same_as<void, T>){}
      |                                                 ^
<source>:5:5: error: invalid constructor; you probably meant 'A<void> (const
A<void>&)'
    5 |     A(A<void>) requires (!std::same_as<void, T>){}
      |     ^
Compiler
```

Reply via email to