-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error in initialization within YY_INITIAL_VALUE() with C++ #442
Labels
bug
Something isn't working
Comments
ydah
added a commit
to ydah/lrama
that referenced
this issue
Jun 11, 2024
Fix: ruby#442 Before: ``` ❯ exe/lrama -d sample/calc.y -o calc.c && cc -Wall calc.c -o calc ❯ exe/lrama -d sample/calc.y -o calc.c && gcc -Wall calc.c -o calc ❯ exe/lrama -d sample/calc.y -o calc.c && c++ -Wall calc.c -o calc clang: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated] calc.c:1199:40: error: default initialization of an object of const type 'const YYSTYPE' without a user-provided default constructor YY_INITIAL_VALUE (static const YYSTYPE yyval_default;) ``` After: ``` ❯ exe/lrama -d sample/calc.y -o calc.c && cc -Wall calc.c -o calc ❯ exe/lrama -d sample/calc.y -o calc.c && gcc -Wall calc.c -o calc ❯ exe/lrama -d sample/calc.y -o calc.c && c++ -Wall calc.c -o calc clang: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated] ```
matz
added a commit
to mruby/mruby
that referenced
this issue
Jun 21, 2024
Unfortunately
causes compilation error when
|
matz
added a commit
to mruby/mruby
that referenced
this issue
Jun 22, 2024
This reverts commit fb9fbc8. The fix in the upstream still causes syntax error in C++.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In the generated C file, we see
YY_INITIAL_VALUE (static YYSTYPE yyval_default;)
, butclang
raises errorerror: default initialization of an object of const type
. According to the C++ language specification, we need a user provided default constructor for this kind of declaration.Changing the above line to 'YY_INITIAL_VALUE (static YYSTYPE yyval_default;)' as Bison 3.8.2 shows no error.
The text was updated successfully, but these errors were encountered: