File tree Expand file tree Collapse file tree 2 files changed +14
-6
lines changed Expand file tree Collapse file tree 2 files changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -3711,13 +3711,17 @@ bool SubprogramVisitor::Pre(const parser::Suffix &suffix) {
3711
3711
bool SubprogramVisitor::Pre (const parser::PrefixSpec &x) {
3712
3712
// Save this to process after UseStmt and ImplicitPart
3713
3713
if (const auto *parsedType{std::get_if<parser::DeclarationTypeSpec>(&x.u )}) {
3714
- FuncResultStack::FuncInfo &info{DEREF (funcResultStack ().Top ())};
3715
- if (info.parsedType ) { // C1543
3716
- Say (currStmtSource ().value (),
3717
- " FUNCTION prefix cannot specify the type more than once" _err_en_US);
3714
+ if (FuncResultStack::FuncInfo * info{funcResultStack ().Top ()}) {
3715
+ if (info->parsedType ) { // C1543
3716
+ Say (currStmtSource ().value (),
3717
+ " FUNCTION prefix cannot specify the type more than once" _err_en_US);
3718
+ } else {
3719
+ info->parsedType = parsedType;
3720
+ info->source = currStmtSource ();
3721
+ }
3718
3722
} else {
3719
- info. parsedType = parsedType;
3720
- info. source = currStmtSource ( );
3723
+ Say ( currStmtSource (). value (),
3724
+ " SUBROUTINE prefix cannot specify a type " _err_en_US );
3721
3725
}
3722
3726
return false ;
3723
3727
} else {
Original file line number Diff line number Diff line change
1
+ ! RUN: %python %S/test_errors.py %s %flang_fc1
2
+ ! ERROR: SUBROUTINE prefix cannot specify a type
3
+ integer subroutine foo
4
+ end
You can’t perform that action at this time.
0 commit comments