@@ -167,15 +167,27 @@ static void CheckExplicitDataArg(const characteristics::DummyDataObject &dummy,
167
167
characteristics::TypeAndShape &actualType, bool isElemental,
168
168
evaluate::FoldingContext &context, const Scope *scope,
169
169
const evaluate::SpecificIntrinsic *intrinsic,
170
- bool allowIntegerConversions ) {
170
+ bool allowActualArgumentConversions ) {
171
171
172
172
// Basic type & rank checking
173
173
parser::ContextualMessages &messages{context.messages ()};
174
174
CheckCharacterActual (actual, dummy.type , actualType, context, messages);
175
- if (allowIntegerConversions ) {
175
+ if (allowActualArgumentConversions ) {
176
176
ConvertIntegerActual (actual, dummy.type , actualType, messages);
177
177
}
178
178
bool typesCompatible{dummy.type .type ().IsTkCompatibleWith (actualType.type ())};
179
+ if (!typesCompatible && dummy.type .Rank () == 0 &&
180
+ allowActualArgumentConversions) {
181
+ // Extension: pass Hollerith literal to scalar as if it had been BOZ
182
+ if (auto converted{
183
+ evaluate::HollerithToBOZ (context, actual, dummy.type .type ())}) {
184
+ messages.Say (
185
+ " passing Hollerith or character literal as if it were BOZ" _port_en_US);
186
+ actual = *converted;
187
+ actualType.type () = dummy.type .type ();
188
+ typesCompatible = true ;
189
+ }
190
+ }
179
191
if (typesCompatible) {
180
192
if (isElemental) {
181
193
} else if (dummy.type .attrs ().test (
@@ -683,7 +695,7 @@ static void CheckExplicitInterfaceArg(evaluate::ActualArgument &arg,
683
695
const characteristics::DummyArgument &dummy,
684
696
const characteristics::Procedure &proc, evaluate::FoldingContext &context,
685
697
const Scope *scope, const evaluate::SpecificIntrinsic *intrinsic,
686
- bool allowIntegerConversions ) {
698
+ bool allowActualArgumentConversions ) {
687
699
auto &messages{context.messages ()};
688
700
std::string dummyName{" dummy argument" };
689
701
if (!dummy.name .empty ()) {
@@ -714,7 +726,7 @@ static void CheckExplicitInterfaceArg(evaluate::ActualArgument &arg,
714
726
object.type .Rank () == 0 && proc.IsElemental ()};
715
727
CheckExplicitDataArg (object, dummyName, *expr, *type,
716
728
isElemental, context, scope, intrinsic,
717
- allowIntegerConversions );
729
+ allowActualArgumentConversions );
718
730
} else if (object.type .type ().IsTypelessIntrinsicArgument () &&
719
731
IsBOZLiteral (*expr)) {
720
732
// ok
@@ -867,7 +879,7 @@ static parser::Messages CheckExplicitInterface(
867
879
const characteristics::Procedure &proc, evaluate::ActualArguments &actuals,
868
880
const evaluate::FoldingContext &context, const Scope *scope,
869
881
const evaluate::SpecificIntrinsic *intrinsic,
870
- bool allowIntegerConversions ) {
882
+ bool allowActualArgumentConversions ) {
871
883
parser::Messages buffer;
872
884
parser::ContextualMessages messages{context.messages ().at (), &buffer};
873
885
RearrangeArguments (proc, actuals, messages);
@@ -878,7 +890,7 @@ static parser::Messages CheckExplicitInterface(
878
890
const auto &dummy{proc.dummyArguments .at (index ++)};
879
891
if (actual) {
880
892
CheckExplicitInterfaceArg (*actual, dummy, proc, localContext, scope,
881
- intrinsic, allowIntegerConversions );
893
+ intrinsic, allowActualArgumentConversions );
882
894
} else if (!dummy.IsOptional ()) {
883
895
if (dummy.name .empty ()) {
884
896
messages.Say (
@@ -909,9 +921,9 @@ parser::Messages CheckExplicitInterface(const characteristics::Procedure &proc,
909
921
910
922
bool CheckInterfaceForGeneric (const characteristics::Procedure &proc,
911
923
evaluate::ActualArguments &actuals, const evaluate::FoldingContext &context,
912
- bool allowIntegerConversions ) {
924
+ bool allowActualArgumentConversions ) {
913
925
return !CheckExplicitInterface (
914
- proc, actuals, context, nullptr , nullptr , allowIntegerConversions )
926
+ proc, actuals, context, nullptr , nullptr , allowActualArgumentConversions )
915
927
.AnyFatalError ();
916
928
}
917
929
0 commit comments