From bbb9a70a0588cf697e54b14f40e27aea5bc5d896 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien@dynare.org> Date: Tue, 24 Jul 2018 12:53:33 +0200 Subject: [PATCH] Macroprocessor: error out when length() operator called on a string or an int Closes DynareTeam/Dynare#1547 (manually cherry-picked from 937659747ab504d6220d89fd492752c31ad1d0c1) --- preprocessor/macro/MacroBison.yy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/preprocessor/macro/MacroBison.yy b/preprocessor/macro/MacroBison.yy index 27c0e4b28..0a9269b45 100644 --- a/preprocessor/macro/MacroBison.yy +++ b/preprocessor/macro/MacroBison.yy @@ -139,7 +139,7 @@ expr : INTEGER } delete $1; } - | LENGTH LPAREN array_expr RPAREN + | LENGTH LPAREN expr RPAREN { TYPERR_CATCH($$ = $3->length(), @$); } | LPAREN expr RPAREN { $$ = $2; } -- GitLab