Skip to content

Fix an error for initialization within YY_INITIAL_VALUE() with C++ - #443

Merged
ydah merged 1 commit into
ruby:masterfrom
ydah:fix-error-in-cpp
Jun 17, 2024
Merged

ydah merged 1 commit into
ruby:masterfrom
ydah:fix-error-in-cpp

Conversation

@ydah

@ydah ydah commented Jun 11, 2024

Copy link
Copy Markdown
Member

Fix: #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]

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]
```
@ydah
ydah merged commit 85efe0e into ruby:master Jun 17, 2024
@ydah
ydah deleted the fix-error-in-cpp branch June 17, 2024 15:34
yui-knk added a commit to yui-knk/lrama that referenced this pull request Jun 18, 2024
This is a follow up of ruby#443
yui-knk added a commit to yui-knk/lrama that referenced this pull request Jun 18, 2024
This is a follow up of ruby#443
yui-knk added a commit to yui-knk/lrama that referenced this pull request Jun 18, 2024
This is a follow up of ruby#443
@yui-knk yui-knk mentioned this pull request Jun 18, 2024
ydah pushed a commit to ydah/lrama that referenced this pull request Aug 9, 2024
This is a follow up of ruby#443
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error in initialization within YY_INITIAL_VALUE() with C++

1 participant