File tree Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -472,6 +472,10 @@ void CheckHelper::Check(const Symbol &symbol) {
472472 messages_.Say (
473473 " A function result may not also be a named constant" _err_en_US);
474474 }
475+ if (!IsProcedurePointer (symbol) && IsProcedure (symbol)) {
476+ messages_.Say (
477+ " A function result may not be a procedure unless it is a procedure pointer" _err_en_US);
478+ }
475479 }
476480 if (IsAutomatic (symbol)) {
477481 if (const Symbol * common{FindCommonBlockContaining (symbol)}) {
Original file line number Diff line number Diff line change 1+ ! RUN: %python %S/test_errors.py %s %flang_fc1
2+
3+ function good () result(pptr)
4+ procedure (), pointer :: pptr
5+ external whatever
6+ pptr = > whatever
7+ end
8+
9+ function bad1 () result(res1)
10+ ! ERROR: A function result may not be a procedure unless it is a procedure pointer
11+ procedure () res1
12+ end
13+
14+ ! ERROR: Procedure 'res2' is referenced before being sufficiently defined in a context where it must be so
15+ function bad2 () result(res2)
16+ ! ERROR: EXTERNAL attribute not allowed on 'res2'
17+ external res2
18+ end
You can’t perform that action at this time.
0 commit comments