zygoloid wrote:

> > Does this work for function-scope operator declarations?
> 
> @zygoloid I am not sure I follow. Could you please give an example.

Sure:

```c++
struct X { operator int(); };

bool f(X x) {
  bool operator==(X, int);
  return x == x;
}


bool g(X x) {
  bool operator==(X, int);
  bool operator!=(X, int);
  return x == x;
}

bool operator!=(X, int);

bool h(X x) {
  bool operator==(X, int);
  return x == x;
}


bool i(X x) {
  bool operator==(X, int);
  bool operator!=(X, int);
  return x == x;
}
```

Based on the standard's rules, it looks like `f` and `g` should be invalid due 
to ambiguity, but `h` and `i` should be valid. (Which I think is a pretty 
surprising outcome, but that's what the rules say.)

If there's not already something like that in our test suite, it'd be good to 
add it.

https://github.com/llvm/llvm-project/pull/68922
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to