As Fortran 2018 C1520, if proc-language-binding-spec with NAME= is
specified, then proc-decl-list shall contain exactly one proc-decl,
which shall neither have the POINTER attribute nor be a dummy procedure.
Add this check.
Details
Diff Detail
Event Timeline
It is checked in check-declarations.cpp, which has better message format. This constraint has the same style as common block and varaibles. I also add the test case in this patch. This one:
!ERROR: Two symbols have the same BIND(C) name 'aaa' procedure(proc), bind(c, name="aaa") :: pc1, pc2
flang/lib/Semantics/resolve-names.cpp | ||
---|---|---|
1050 | Thanks. Fixed. | |
4687 | This is not correct for procedure(proc), bind(c, name="bbb"), pointer :: pc3 since it has multiple parser::ProcAttrSpec. Also add one break here to speedup this analysis. Put the assignment not in the if condition will also fail for the case procedure(proc), bind(c, name="pc8"), bind(c), pointer :: pc8 (Check the test case below). |
flang/lib/Semantics/resolve-names.cpp | ||
---|---|---|
4766 | Can this check be done in check-declarations? |
flang/lib/Semantics/resolve-names.cpp | ||
---|---|---|
4766 | It seems not since it is unknown if the bind name is from NAME= specifier. The test cases are added in this patch: !ERROR: BIND(C) procedure with NAME= specified can neither have POINTER attribute nor be a dummy procedure procedure(proc), bind(c, name="pc6"), pointer :: pc6 procedure(proc), bind(c), pointer :: pc7 |
The data member should be hasBindCName_ and it is its own comment.