From 13de117b8e52f4d7c1c5e3a0ece89f380d36975b Mon Sep 17 00:00:00 2001 From: florian Date: Sun, 16 Jun 2024 10:51:45 +0200 Subject: [PATCH] * give better error message for #40821 --- compiler/msg/errore.msg | 3 +++ compiler/pdecl.pas | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/compiler/msg/errore.msg b/compiler/msg/errore.msg index b6fc0fac24..505caad31f 100644 --- a/compiler/msg/errore.msg +++ b/compiler/msg/errore.msg @@ -1679,6 +1679,9 @@ parser_e_nostringaliasinsystem=03370_E_Using 'string' alias is not allowed in th parser_e_coperators_off=03371_E_C styled assignment operators are turned off % By default, c style assignment operators (+=, -=, *=, /=) are turn off. Either turn them on by the command line % parameter -Sc or in the source code by {\$COPERATORS ON} +parser_e_cannot_evaluate_expression_at_compile_time=03372_E_Expression cannot be evaluted at compile time +% Certain operations like the size of an object cannot be determined at compile time, +% so it cannot be e.g. part of a constant expression. % % \end{description} % diff --git a/compiler/pdecl.pas b/compiler/pdecl.pas index c35dec9690..dd1dfc2f3e 100644 --- a/compiler/pdecl.pas +++ b/compiler/pdecl.pas @@ -174,7 +174,7 @@ implementation information about the final type yet, we need to use safe values (mostly 0, except for (Bit)SizeOf()) } if not parse_generic then - Message(parser_e_illegal_expression); + Message(parser_e_cannot_evaluate_expression_at_compile_time); case tinlinenode(p).inlinenumber of in_sizeof_x: begin