[clang] [Clang] Fix __is_array returning true for zero-sized arrays (PR #86652)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Wed May 15 10:04:50 PDT 2024


================
@@ -5143,6 +5143,10 @@ static bool EvaluateUnaryTypeTrait(Sema &Self, TypeTrait UTT,
   case UTT_IsFloatingPoint:
     return T->isFloatingType();
   case UTT_IsArray:
+    // zero-sized arrays aren't considered arrays in partial specializations,
+    // so __is_array shouldn't consider them arrays either.
+    if (const auto* CAT = C.getAsConstantArrayType(T))
----------------
AaronBallman wrote:

```suggestion
    if (const auto *CAT = C.getAsConstantArrayType(T))
```

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


More information about the cfe-commits mailing list