"Type-Spec in ALLOCATE must not be TEAM_TYPE from ISO_FORTRAN_ENV when an allocatable object is a coarray"_err_en_US)
.Attach(name_.source, "'%s' is a coarray"_en_US, name_.source);
return false;
- } else if (IsDerivedTypeFromModule(derived, "iso_c_binding", "c_ptr") ||
- IsDerivedTypeFromModule(derived, "iso_c_binding", "c_funptr")) {
+ } else if (IsIsoCType(derived)) {
context
.Say(allocateInfo_.typeSpecLoc.value(),
"Type-Spec in ALLOCATE must not be C_PTR or C_FUNPTR from ISO_C_BINDING when an allocatable object is a coarray"_err_en_US)
"SOURCE or MOLD expression type must not be TEAM_TYPE from ISO_FORTRAN_ENV when an allocatable object is a coarray"_err_en_US)
.Attach(name_.source, "'%s' is a coarray"_en_US, name_.source);
return false;
- } else if (IsDerivedTypeFromModule(
- &derived, "iso_c_binding", "c_ptr") ||
- IsDerivedTypeFromModule(&derived, "iso_c_binding", "c_funptr")) {
+ } else if (IsIsoCType(&derived)) {
context
.Say(allocateInfo_.sourceExprLoc.value(),
"SOURCE or MOLD expression type must not be C_PTR or C_FUNPTR from ISO_C_BINDING when an allocatable object is a coarray"_err_en_US)
}
}
+bool IsIsoCType(const DerivedTypeSpec *derived) {
+ return IsDerivedTypeFromModule(derived, "iso_c_binding", "c_ptr") ||
+ IsDerivedTypeFromModule(derived, "iso_c_binding", "c_funptr");
+}
+
bool IsTeamType(const DerivedTypeSpec *derived) {
return IsDerivedTypeFromModule(derived, "iso_fortran_env", "team_type");
}
// Is this a derived type from module with this name?
bool IsDerivedTypeFromModule(
const DerivedTypeSpec *derived, const char *module, const char *name);
-bool IsTeamType(const DerivedTypeSpec *derived);
+// Is this derived type TEAM_TYPE from module ISO_FORTRAN_ENV
+bool IsTeamType(const DerivedTypeSpec *);
+// Is this derived type either C_PTR or C_FUNPTR from module ISO_C_BINDING
+bool IsIsoCType(const DerivedTypeSpec *);
const bool IsEventTypeOrLockType(const DerivedTypeSpec *);
// Returns an ultimate component symbol that is a
// coarray or nullptr if there are no such component.