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

            Bug ID: 90097
           Summary: [P0732] Error while comparing 2 non-type parameters in
                    constraints
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mateusz.pusz at gmail dot com
  Target Milestone: ---

Hi,

Compiling the code provided below with the following options produces an error:
"-std=c++2a -fconcepts -Wall -Wextra"

```
struct B {
    int value;
    // auto operator<=>(const base_dimension&) = default;
    friend constexpr bool operator==(const B& lhs, const B& rhs) noexcept {
return lhs.value == rhs.value; }
};

//works
template<int i1, int i2>
  requires (i1 == i2)
struct A {};

// works
template<B b1, B b2, bool BB = (b1 == b2)>
struct C {
    static_assert(b1 == b2);
};

// error
template<B b1, B b2>
  requires (b1 == b2)
struct D {};
```

Error:
<source>:24:16: error: constraint 'operator==(((const B)b1), ((const B)b2))',
uses overloaded operator
   24 |   requires (b1 == b2)
      |            ~~~~^~~~~~

I am not sure what is the offcial suport -fconcepts and if that problem can be
ignored for now or not so I decided to report it anyway ;-)

See also here: https://godbolt.org/z/PLkvVm.

Thanks

Mat

Reply via email to