@@ -139,7 +139,7 @@ class CheckHelper {
139
139
void CheckProcedureAssemblyName (const Symbol &symbol);
140
140
void CheckExplicitSave (const Symbol &);
141
141
parser::Messages WhyNotInteroperableDerivedType (const Symbol &, bool isError);
142
- parser::Messages WhyNotInteroperableObject (const Symbol &, bool isError );
142
+ parser::Messages WhyNotInteroperableObject (const Symbol &);
143
143
parser::Messages WhyNotInteroperableFunctionResult (const Symbol &);
144
144
parser::Messages WhyNotInteroperableProcedure (const Symbol &, bool isError);
145
145
void CheckBindC (const Symbol &);
@@ -2981,15 +2981,13 @@ parser::Messages CheckHelper::WhyNotInteroperableDerivedType(
2981
2981
return msgs;
2982
2982
}
2983
2983
2984
- parser::Messages CheckHelper::WhyNotInteroperableObject (
2985
- const Symbol &symbol, bool isError) {
2984
+ parser::Messages CheckHelper::WhyNotInteroperableObject (const Symbol &symbol) {
2986
2985
parser::Messages msgs;
2987
2986
if (examinedByWhyNotInteroperable_.find (symbol) !=
2988
2987
examinedByWhyNotInteroperable_.end ()) {
2989
2988
return msgs;
2990
2989
}
2991
2990
bool isExplicitBindC{symbol.attrs ().test (Attr::BIND_C)};
2992
- isError |= isExplicitBindC;
2993
2991
examinedByWhyNotInteroperable_.insert (symbol);
2994
2992
CHECK (symbol.has <ObjectEntityDetails>());
2995
2993
if (isExplicitBindC && !symbol.owner ().IsModule ()) {
@@ -3018,11 +3016,11 @@ parser::Messages CheckHelper::WhyNotInteroperableObject(
3018
3016
}
3019
3017
if (const auto *type{symbol.GetType ()}) {
3020
3018
const auto *derived{type->AsDerived ()};
3021
- if (derived) {
3022
- if (derived-> typeSymbol (). attrs (). test (Attr::BIND_C)) {
3023
- } else if (isError ) {
3019
+ if (derived && !derived-> typeSymbol (). attrs (). test (Attr::BIND_C) ) {
3020
+ if (!context_. IsEnabled (
3021
+ common::LanguageFeature::NonBindCInteroperability) ) {
3024
3022
msgs.Say (symbol.name (),
3025
- " The derived type of a BIND(C) object must also be BIND(C)" _err_en_US)
3023
+ " The derived type of an interoperable object must be BIND(C)" _err_en_US)
3026
3024
.Attach (derived->typeSymbol ().name (), " Non-BIND(C) type" _en_US);
3027
3025
} else if (auto bad{WhyNotInteroperableDerivedType (
3028
3026
derived->typeSymbol (), /* isError=*/ false )};
@@ -3155,7 +3153,7 @@ parser::Messages CheckHelper::WhyNotInteroperableProcedure(
3155
3153
" A dummy procedure of an interoperable procedure should be BIND(C)" _warn_en_US);
3156
3154
}
3157
3155
} else if (dummy->has <ObjectEntityDetails>()) {
3158
- dummyMsgs = WhyNotInteroperableObject (*dummy, /* isError= */ false );
3156
+ dummyMsgs = WhyNotInteroperableObject (*dummy);
3159
3157
} else {
3160
3158
CheckBindC (*dummy);
3161
3159
}
@@ -3225,7 +3223,7 @@ void CheckHelper::CheckBindC(const Symbol &symbol) {
3225
3223
}
3226
3224
}
3227
3225
if (symbol.has <ObjectEntityDetails>()) {
3228
- whyNot = WhyNotInteroperableObject (symbol, /* isError= */ isExplicitBindC );
3226
+ whyNot = WhyNotInteroperableObject (symbol);
3229
3227
} else if (symbol.has <ProcEntityDetails>() ||
3230
3228
symbol.has <SubprogramDetails>()) {
3231
3229
whyNot = WhyNotInteroperableProcedure (symbol, /* isError=*/ isExplicitBindC);
0 commit comments