[clang] [clang][Interp] Decay arrays to the first element (PR #72660)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 8 09:37:29 PST 2023


================
@@ -27,6 +27,9 @@ static_assert(foo[2][3] == &m, "");
 static_assert(foo[2][4] == nullptr, "");
 
 
+const int SomeInt[] = {1};
+int getSomeInt() { return *SomeInt; }
----------------
AaronBallman wrote:

```suggestion
constexpr int SomeInt[] = {1};
constexpr int getSomeInt() { return *SomeInt; }

static_assert(getSomeInt() == 1);
```
so we're testing the decayed pointer.

https://github.com/llvm/llvm-project/pull/72660


More information about the cfe-commits mailing list