Issue 58185
Summary [clang][c++20] Match requires clause while considering operator == with reversed arguments
Labels c++20, clang:frontend
Assignees
Reporter usx95
    This is regarding one unimplemented bit of [P2468R2](https://wg21.link/p2468)
We must match the trailing requires clause [basic.scope.scope#4.3.1](https://eel.is/c++draft/basic.scope.scope#4.3.1) to check if we have a "**corresponding** `operator !=`.

Precisely, The following code should pass.
```
template<int x>
struct A {
bool operator==(int) requires (x==1); // 1.
bool operator!=(int) requires (x==2); // 2.
};
int a1 = 0 == A<1>();
```
Reversed 1 should be considered for `0==A<1>` (//2 does not forbid reversed operator).

Currently, in the first attempt I could not find a way to match requires clause.
Eg:
```
template<int x>
struct A {
bool operator==(int) requires (x==1); // 1.
bool operator!=(int) requires (x==1); // 2.
};
int a1 = 0 == A<1>(); // This is expected to error as we have a matching operator !=.
```


Note: This was not addressed in #57711 as it aims to fix **backward incompatible** change of C++20 of ambiguity in `operator ==` with reversed argument order. I do not expect this to be a very pressing issue.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to