[flang-commits] [flang] [flang] Implement conditional expressions parser/semantics (F2023) (PR #186489)

Peter Klausler via flang-commits flang-commits at lists.llvm.org
Mon Mar 16 12:19:38 PDT 2026


================
@@ -189,6 +189,16 @@ class GetShapeHelper
   Result operator()(const ArrayConstructor<T> &aconst) const {
     return Shape{GetArrayConstructorExtent(aconst)};
   }
+  template <typename T>
+  Result operator()(const ConditionalExpr<T> &conditional) const {
+    // Per F2023 10.1.4(7), the shape is determined by the selected branch,
+    // so return unknown extents for the rank.
----------------
klausler wrote:

The shape is the same for all outcomes so you could just pick one if there's a safe option that isn't optional, pointer, or allocatable.

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


More information about the flang-commits mailing list