@@ -495,7 +495,7 @@ Expr<SomeComplex> PromoteMixedComplexReal(
495495// N.B. When a "typeless" BOZ literal constant appears as one (not both!) of
496496// the operands to a dyadic operation where one is permitted, it assumes the
497497// type and kind of the other operand.
498- template <template <typename > class OPR , bool CAN_BE_UNSIGNED >
498+ template <template <typename > class OPR >
499499std::optional<Expr<SomeType>> NumericOperation (
500500 parser::ContextualMessages &messages, Expr<SomeType> &&x,
501501 Expr<SomeType> &&y, int defaultRealKind) {
@@ -510,13 +510,8 @@ std::optional<Expr<SomeType>> NumericOperation(
510510 std::move (rx), std::move (ry)));
511511 },
512512 [&](Expr<SomeUnsigned> &&ix, Expr<SomeUnsigned> &&iy) {
513- if constexpr (CAN_BE_UNSIGNED) {
514- return Package (PromoteAndCombine<OPR, TypeCategory::Unsigned>(
515- std::move (ix), std::move (iy)));
516- } else {
517- messages.Say (" Operands must not be UNSIGNED" _err_en_US);
518- return NoExpr ();
519- }
513+ return Package (PromoteAndCombine<OPR, TypeCategory::Unsigned>(
514+ std::move (ix), std::move (iy)));
520515 },
521516 // Mixed REAL/INTEGER operations
522517 [](Expr<SomeReal> &&rx, Expr<SomeInteger> &&iy) {
@@ -575,34 +570,31 @@ std::optional<Expr<SomeType>> NumericOperation(
575570 },
576571 // Operations with one typeless operand
577572 [&](BOZLiteralConstant &&bx, Expr<SomeInteger> &&iy) {
578- return NumericOperation<OPR, CAN_BE_UNSIGNED >(messages,
573+ return NumericOperation<OPR>(messages,
579574 AsGenericExpr (ConvertTo (iy, std::move (bx))), std::move (y),
580575 defaultRealKind);
581576 },
582577 [&](BOZLiteralConstant &&bx, Expr<SomeUnsigned> &&iy) {
583- return NumericOperation<OPR, CAN_BE_UNSIGNED >(messages,
578+ return NumericOperation<OPR>(messages,
584579 AsGenericExpr (ConvertTo (iy, std::move (bx))), std::move (y),
585580 defaultRealKind);
586581 },
587582 [&](BOZLiteralConstant &&bx, Expr<SomeReal> &&ry) {
588- return NumericOperation<OPR, CAN_BE_UNSIGNED >(messages,
583+ return NumericOperation<OPR>(messages,
589584 AsGenericExpr (ConvertTo (ry, std::move (bx))), std::move (y),
590585 defaultRealKind);
591586 },
592587 [&](Expr<SomeInteger> &&ix, BOZLiteralConstant &&by) {
593- return NumericOperation<OPR, CAN_BE_UNSIGNED>(messages,
594- std::move (x), AsGenericExpr (ConvertTo (ix, std::move (by))),
595- defaultRealKind);
588+ return NumericOperation<OPR>(messages, std::move (x),
589+ AsGenericExpr (ConvertTo (ix, std::move (by))), defaultRealKind);
596590 },
597591 [&](Expr<SomeUnsigned> &&ix, BOZLiteralConstant &&by) {
598- return NumericOperation<OPR, CAN_BE_UNSIGNED>(messages,
599- std::move (x), AsGenericExpr (ConvertTo (ix, std::move (by))),
600- defaultRealKind);
592+ return NumericOperation<OPR>(messages, std::move (x),
593+ AsGenericExpr (ConvertTo (ix, std::move (by))), defaultRealKind);
601594 },
602595 [&](Expr<SomeReal> &&rx, BOZLiteralConstant &&by) {
603- return NumericOperation<OPR, CAN_BE_UNSIGNED>(messages,
604- std::move (x), AsGenericExpr (ConvertTo (rx, std::move (by))),
605- defaultRealKind);
596+ return NumericOperation<OPR>(messages, std::move (x),
597+ AsGenericExpr (ConvertTo (rx, std::move (by))), defaultRealKind);
606598 },
607599 // Error cases
608600 [&](Expr<SomeUnsigned> &&, auto &&) {
@@ -621,7 +613,7 @@ std::optional<Expr<SomeType>> NumericOperation(
621613 std::move (x.u ), std::move (y.u ));
622614}
623615
624- template std::optional<Expr<SomeType>> NumericOperation<Power, false >(
616+ template std::optional<Expr<SomeType>> NumericOperation<Power>(
625617 parser::ContextualMessages &, Expr<SomeType> &&, Expr<SomeType> &&,
626618 int defaultRealKind);
627619template std::optional<Expr<SomeType>> NumericOperation<Multiply>(
0 commit comments