Fznamznon added inline comments.

================
Comment at: clang/test/SemaCXX/overloaded-operator-decl.cpp:64
+class E {};
+void operator+(E, ...) {} // expected-error{{overloaded 'operator+' cannot be 
variadic}}
+void d() { E() + E(); }
----------------
aaron.ballman wrote:
> I think it might make sense to extend the test coverage for the other 
> operators you can overload, just to demonstrate we diagnose them all 
> consistently. WDYT?
Okay, while trying to add more test cases I discovered that following
```
class E {};
bool operator<(const E& lhs, ...);
auto operator<=>(const E& lhs, ...);

void d() {
  E() < E();
}
```
crashes even with the patch since there is code searching for best overload 
candidate that doesn't consider possibility for them making variadic.
The code around overloading is actually pretty inconsistent, somewhere invalid 
candidates are considered, and somewhere not, so I spent some time not knowing 
what to do.
I'm now inclined that we just shouldn't consider invalid candidates like 
@shafik 
suggests. WDYY?



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D156244/new/

https://reviews.llvm.org/D156244

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to