diff --git a/flang/lib/Evaluate/tools.cpp b/flang/lib/Evaluate/tools.cpp index 2d0e1996632fc..16b0260719097 100644 --- a/flang/lib/Evaluate/tools.cpp +++ b/flang/lib/Evaluate/tools.cpp @@ -212,6 +212,11 @@ ConvertRealOperandsResult ConvertRealOperands( return {AsSameKindExprs( ConvertTo(ry, std::move(bx)), std::move(ry))}; }, + [&](BOZLiteralConstant &&, + BOZLiteralConstant &&) -> ConvertRealOperandsResult { + messages.Say("operands cannot both be BOZ"_err_en_US); + return std::nullopt; + }, [&](auto &&, auto &&) -> ConvertRealOperandsResult { // C718 messages.Say( "operands must be INTEGER, UNSIGNED, REAL, or BOZ"_err_en_US); diff --git a/flang/test/Semantics/complex01.f90 b/flang/test/Semantics/complex01.f90 index c9d408ee0e111..d268eafa68589 100644 --- a/flang/test/Semantics/complex01.f90 +++ b/flang/test/Semantics/complex01.f90 @@ -1,5 +1,5 @@ ! RUN: %python %S/test_errors.py %s %flang_fc1 -! C718 Each named constant in a complex literal constant shall be of type +! C718 Each named constant in a complex literal constant shall be of type ! integer or real. subroutine s() integer :: ivar = 35 @@ -30,4 +30,6 @@ subroutine s() complex :: cvar11 = (cconst, 1.0) !ERROR: operands must be INTEGER, UNSIGNED, REAL, or BOZ complex :: cvar12 = (lconst, 1.0) + !ERROR: operands cannot both be BOZ + complex :: cvar13 = (z'3f700000', z'00000000') end subroutine s