From fb9fbc8498c2e28005a422481760d27c3dff7338 Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Tue, 18 Jun 2024 21:12:20 +0900 Subject: [PATCH] tools/lrama: apply ruby/lrama#442 --- tools/lrama/template/bison/yacc.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/lrama/template/bison/yacc.c b/tools/lrama/template/bison/yacc.c index 42d875605..37ea4f50b 100644 --- a/tools/lrama/template/bison/yacc.c +++ b/tools/lrama/template/bison/yacc.c @@ -1475,7 +1475,11 @@ int yychar; /* The semantic value of the lookahead symbol. */ /* Default value used for initialization, for pacifying older GCCs or non-GCC compilers. */ -YY_INITIAL_VALUE (static YYSTYPE yyval_default;) +#ifdef __cplusplus +static const YYSTYPE yyval_default = YY_INITIAL_VALUE(YYSTYPE()); +#else +YY_INITIAL_VALUE (static const YYSTYPE yyval_default;) +#endif YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); /* Location data for the lookahead symbol. */