[flang-commits] [flang] [llvm] [Flang] KIND De-templatization (PR #216960)

Eugene Epshteyn via flang-commits flang-commits at lists.llvm.org
Wed Oct 21 15:53:53 PDT 2026


================
@@ -342,49 +356,55 @@ template <typename A> struct Extremum : public Operation<Extremum<A>, A, A, A> {
   using Base = Operation<Extremum, A, A, A>;
   CLASS_BOILERPLATE(Extremum)
   Extremum(Ordering ord, const Expr<Operand> &x, const Expr<Operand> &y)
-      : Base{x, y}, ordering{ord} {}
+      : Base{x.kind(), x, y}, ordering{ord} {
+    CHECK(x.kind() == y.kind());
+  }
   Extremum(Ordering ord, Expr<Operand> &&x, Expr<Operand> &&y)
-      : Base{std::move(x), std::move(y)}, ordering{ord} {}
+      : Base{x.kind(), std::move(x), std::move(y)}, ordering{ord} {
+    CHECK(x.kind() == y.kind());
----------------
eugeneepshteyn wrote:

This `CHECK` reads `x` and `y` after they have been moved into `Base`; the same happens at lines 426 and 778, in `expression.cpp:398` and `constant.cpp:226`. It works only because a moved-from object keeps its kind. `ComplexConstructor` and `Concat` check `left()`/`right()` instead; could these do the same?


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


More information about the flang-commits mailing list