[PATCH] D149637: [Clang] Correctly expand pack in binary subscript expression.

Corentin Jabot via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 2 08:12:02 PDT 2023


cor3ntin added inline comments.


================
Comment at: clang/test/SemaCXX/cxx2b-overloaded-operator.cpp:101
+  int arr[] = {1, 2, 3};
+  return arr[Is...]; // expected-error 2{{type 'int[3]' does not provide a subscript operator}}
+}
----------------
shafik wrote:
> The diagnostic is not great.
Indeed. The issue is that we only add the built-in to the set of candidates if there are two args (ie one index, after expansion).
So we cannot produce a nice error with mismatching arity.
I looked into changing that but it requires some refactor to how we add built-in to the overload set and diagnose built-ins. 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D149637



More information about the cfe-commits mailing list