@@ -35,7 +35,8 @@ static void CheckImplicitInterfaceArg(evaluate::ActualArgument &arg,
35
35
" Keyword '%s=' may not appear in a reference to a procedure with an implicit interface" _err_en_US,
36
36
*kw);
37
37
}
38
- if (auto type{arg.GetType ()}) {
38
+ auto type{arg.GetType ()};
39
+ if (type) {
39
40
if (type->IsAssumedType ()) {
40
41
messages.Say (
41
42
" Assumed type actual argument requires an explicit interface" _err_en_US);
@@ -49,6 +50,11 @@ static void CheckImplicitInterfaceArg(evaluate::ActualArgument &arg,
49
50
}
50
51
}
51
52
}
53
+ if (arg.isPercentVal () &&
54
+ (!type || !type->IsLengthlessIntrinsicType () || arg.Rank () != 0 )) {
55
+ messages.Say (
56
+ " %VAL argument must be a scalar numeric or logical expression" _err_en_US);
57
+ }
52
58
if (const auto *expr{arg.UnwrapExpr ()}) {
53
59
if (IsBOZLiteral (*expr)) {
54
60
messages.Say (" BOZ argument requires an explicit interface" _err_en_US);
@@ -314,7 +320,8 @@ static void CheckExplicitDataArg(const characteristics::DummyDataObject &dummy,
314
320
SemanticsContext &context, evaluate::FoldingContext &foldingContext,
315
321
const Scope *scope, const evaluate::SpecificIntrinsic *intrinsic,
316
322
bool allowActualArgumentConversions, bool extentErrors,
317
- const characteristics::Procedure &procedure) {
323
+ const characteristics::Procedure &procedure,
324
+ const evaluate::ActualArgument &arg) {
318
325
319
326
// Basic type & rank checking
320
327
parser::ContextualMessages &messages{foldingContext.messages ()};
@@ -939,11 +946,25 @@ static void CheckExplicitDataArg(const characteristics::DummyDataObject &dummy,
939
946
}
940
947
}
941
948
942
- // Breaking change warnings
949
+ // Warning for breaking F'2023 change with character allocatables
943
950
if (intrinsic && dummy.intent != common::Intent::In) {
944
951
WarnOnDeferredLengthCharacterScalar (
945
952
context, &actual, messages.at (), dummyName.c_str ());
946
953
}
954
+
955
+ // %VAL() and %REF() checking for explicit interface
956
+ if ((arg.isPercentRef () || arg.isPercentVal ()) &&
957
+ dummy.IsPassedByDescriptor (procedure.IsBindC ())) {
958
+ messages.Say (
959
+ " %VAL or %REF are not allowed for %s that must be passed by means of a descriptor" _err_en_US,
960
+ dummyName);
961
+ }
962
+ if (arg.isPercentVal () &&
963
+ (!actualType.type ().IsLengthlessIntrinsicType () ||
964
+ actualType.Rank () != 0 )) {
965
+ messages.Say (
966
+ " %VAL argument must be a scalar numeric or logical expression" _err_en_US);
967
+ }
947
968
}
948
969
949
970
static void CheckProcedureArg (evaluate::ActualArgument &arg,
@@ -1152,7 +1173,7 @@ static void CheckExplicitInterfaceArg(evaluate::ActualArgument &arg,
1152
1173
object.type .Rank () == 0 && proc.IsElemental ()};
1153
1174
CheckExplicitDataArg (object, dummyName, *expr, *type,
1154
1175
isElemental, context, foldingContext, scope, intrinsic,
1155
- allowActualArgumentConversions, extentErrors, proc);
1176
+ allowActualArgumentConversions, extentErrors, proc, arg );
1156
1177
} else if (object.type .type ().IsTypelessIntrinsicArgument () &&
1157
1178
IsBOZLiteral (*expr)) {
1158
1179
// ok
0 commit comments