[PATCH] D132727: [clang][Interp] Implement array initializers and subscript expressions

Timm Bäder via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 31 06:13:36 PDT 2022


tbaeder marked an inline comment as done.
tbaeder added inline comments.


================
Comment at: clang/test/AST/Interp/arrays.cpp:41-44
+template<typename T>
+constexpr T getElementOf(T* array, int i) {
+  return array[i];
+}
----------------
aaron.ballman wrote:
> A similar test we might want to add (whenever we get around to references):
> ```
> template <typename T, int N>
> constexpr T& getElementOf(T (&array)[N], int I) {
>   return array[I];
> }
> static_assert(getElementOf(foo[2], 3) == &m, "");
> ```
I added that to https://reviews.llvm.org/D132997


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

https://reviews.llvm.org/D132727



More information about the cfe-commits mailing list