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

            Bug ID: 128889
           Summary: GCC rejects valid program with deleted conversion
                    operator bool
           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 program is rejected by gcc and msvc but accepted by clang:
https://godbolt.org/z/sY76sf6e8

```
#include <concepts>

struct X {
    operator bool() const = delete; 


    operator int() const {
        return 1;
    }
};

template<typename T>
concept shiftable = requires(T x) {
    1 << x;
};

static_assert(!std::convertible_to<X, bool>);
static_assert(!shiftable<X>); // fails with MSVC and gcc, compiles with clang
```

Reply via email to