diff --git a/tests/testsuite.src/syn_misc.at b/tests/testsuite.src/syn_misc.at index 8a11f5128..94ff7b0d0 100644 --- a/tests/testsuite.src/syn_misc.at +++ b/tests/testsuite.src/syn_misc.at @@ -5776,6 +5776,8 @@ prog.cob:8: error: syntax error, unexpected Literal ]) AT_CLEANUP +# Let's add a double quote here " to match the one in the error and +# please emacs coloring... # normal register extension, # active for lax and standard configurations @@ -8348,3 +8350,43 @@ AT_CHECK([$COBCRUN_DIRECT ./prog], [0], [1]) AT_CLEANUP + +AT_SETUP([PROTOTYPE parameter validation]) +AT_KEYWORDS([prototypes VALUE]) + +AT_DATA([prog.cob], [ + IDENTIFICATION DIVISION. + PROGRAM-ID. f PROTOTYPE. + DATA DIVISION. + LINKAGE SECTION. + 01 a PIC X(20). + 01 b ANY LENGTH. + *> BINARY-C-INT usage does not exist: error on purpose to + *> trigger an error below + 01 c USAGE BINARY-C-INT. + *> This one should also trigger an error, but does not... + 78 d-const VALUE "abc". + PROCEDURE DIVISION + USING a + BY REFERENCE b + BY VALUE b + c + d-const + RETURNING OMITTED. + END PROGRAM f. +]) + +AT_CHECK([$COMPILE_ONLY -Wno-unfinished prog.cob], [134], [], +[prog.cob:10: error: unknown USAGE: BINARY-C-INT +prog.cob:16: error: ANY LENGTH items may only be BY REFERENCE formal parameters + +cobc: ../../cobc/parser.y:11030: invalid cast from 'internal error node' type CONSTANT to type FIELD + +cobc: aborting compile of prog.cob at line 18 (PROGRAM-ID: f) + +cobc: Please report this! +Aborted (core dumped) +]) + +AT_CLEANUP +