[PATCH] D123182: [Concepts] Fix overload resolution bug with constrained candidates

Erich Keane via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 12 06:46:54 PDT 2022


erichkeane added inline comments.


================
Comment at: clang/lib/Sema/SemaOverload.cpp:2967
+         "parameters!");
+  for (FunctionProtoType::param_type_iterator
+           O = OldType->param_type_begin(),
----------------
Thanks for the clarification on 'Reversed'.  The comment makes it more clear.

This whole 'for' header is... really tough to mentally parse, even BEFORE this, and now it is even worse with 'Reversed' involved.  I would prefer that the iterators be initialized ahead of time.  Additionally, can we use `reverse_iterator` for the 'NewType' instead of branching on `Reversed` here?  

Any other suggestions you have to simplify this loop would also be appreciated.  I might ALSO consider using 'zip' here?


================
Comment at: clang/lib/Sema/SemaOverload.cpp:2972
+           E = OldType->param_type_end();
+       O && (O != E); ++O, (Reversed ? --N : ++N)) {
     // Ignore address spaces in pointee type. This is to disallow overloading
----------------
O AND O !=E?  This condition reads wackily....


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D123182



More information about the cfe-commits mailing list