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

            Bug ID: 114625
           Summary: requires { T{}; } wrongly accepted when T{} is
                    ill-formed
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ted at lyncon dot se
  Target Milestone: ---

This program compiles but I'd expect both `static_assert`s to refuse it since
`d x{};` is invalid.
```
#include <concepts>

template<class T>
concept default_initializable =
    std::constructible_from<T> &&
    requires { T{}; } &&
    requires { ::new T; };

struct b { explicit b(auto...) {} };
struct d : b {};

int main() {
    static_assert(default_initializable<d>);
    static_assert(std::default_initializable<d>);
    //d x{}; // ERROR
}
```

Reply via email to