@@ -143,7 +143,7 @@ class CheckHelper {
143
143
void CheckProcedureAssemblyName (const Symbol &symbol);
144
144
void CheckExplicitSave (const Symbol &);
145
145
parser::Messages WhyNotInteroperableDerivedType (const Symbol &);
146
- parser::Messages WhyNotInteroperableObject (const Symbol &, bool isError );
146
+ parser::Messages WhyNotInteroperableObject (const Symbol &);
147
147
parser::Messages WhyNotInteroperableFunctionResult (const Symbol &);
148
148
parser::Messages WhyNotInteroperableProcedure (const Symbol &, bool isError);
149
149
void CheckBindC (const Symbol &);
@@ -3012,15 +3012,13 @@ parser::Messages CheckHelper::WhyNotInteroperableDerivedType(
3012
3012
return msgs;
3013
3013
}
3014
3014
3015
- parser::Messages CheckHelper::WhyNotInteroperableObject (
3016
- const Symbol &symbol, bool isError) {
3015
+ parser::Messages CheckHelper::WhyNotInteroperableObject (const Symbol &symbol) {
3017
3016
parser::Messages msgs;
3018
3017
if (examinedByWhyNotInteroperable_.find (symbol) !=
3019
3018
examinedByWhyNotInteroperable_.end ()) {
3020
3019
return msgs;
3021
3020
}
3022
3021
bool isExplicitBindC{symbol.attrs ().test (Attr::BIND_C)};
3023
- isError |= isExplicitBindC;
3024
3022
examinedByWhyNotInteroperable_.insert (symbol);
3025
3023
CHECK (symbol.has <ObjectEntityDetails>());
3026
3024
if (isExplicitBindC && !symbol.owner ().IsModule ()) {
@@ -3049,11 +3047,11 @@ parser::Messages CheckHelper::WhyNotInteroperableObject(
3049
3047
}
3050
3048
if (const auto *type{symbol.GetType ()}) {
3051
3049
const auto *derived{type->AsDerived ()};
3052
- if (derived) {
3053
- if (derived-> typeSymbol (). attrs (). test (Attr::BIND_C)) {
3054
- } else if (isError ) {
3050
+ if (derived && !derived-> typeSymbol (). attrs (). test (Attr::BIND_C) ) {
3051
+ if (!context_. IsEnabled (
3052
+ common::LanguageFeature::NonBindCInteroperability) ) {
3055
3053
msgs.Say (symbol.name (),
3056
- " The derived type of a BIND(C) object must also be BIND(C)" _err_en_US)
3054
+ " The derived type of an interoperable object must be BIND(C)" _err_en_US)
3057
3055
.Attach (derived->typeSymbol ().name (), " Non-BIND(C) type" _en_US);
3058
3056
} else if (auto bad{
3059
3057
WhyNotInteroperableDerivedType (derived->typeSymbol ())};
@@ -3186,7 +3184,7 @@ parser::Messages CheckHelper::WhyNotInteroperableProcedure(
3186
3184
" A dummy procedure of an interoperable procedure should be BIND(C)" _warn_en_US);
3187
3185
}
3188
3186
} else if (dummy->has <ObjectEntityDetails>()) {
3189
- dummyMsgs = WhyNotInteroperableObject (*dummy, /* isError= */ false );
3187
+ dummyMsgs = WhyNotInteroperableObject (*dummy);
3190
3188
} else {
3191
3189
CheckBindC (*dummy);
3192
3190
}
@@ -3256,7 +3254,7 @@ void CheckHelper::CheckBindC(const Symbol &symbol) {
3256
3254
}
3257
3255
}
3258
3256
if (symbol.has <ObjectEntityDetails>()) {
3259
- whyNot = WhyNotInteroperableObject (symbol, /* isError= */ isExplicitBindC );
3257
+ whyNot = WhyNotInteroperableObject (symbol);
3260
3258
} else if (symbol.has <ProcEntityDetails>() ||
3261
3259
symbol.has <SubprogramDetails>()) {
3262
3260
whyNot = WhyNotInteroperableProcedure (symbol, /* isError=*/ isExplicitBindC);
0 commit comments