Skip to content
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: ‘reverse’ is not a member of ‘std’ #377

Closed
hangingman opened this issue Aug 25, 2021 · 5 comments
Closed

error: ‘reverse’ is not a member of ‘std’ #377

hangingman opened this issue Aug 25, 2021 · 5 comments
Assignees
Labels
C++ parser Issues concerning parser generating regression in 2.9.2 Regression that first appeared in BNFC 2.9.2
Milestone

Comments

@hangingman
Copy link

On C++ backend, generated codes should add #include <algorithm>

This is my output logs during building bnfc generated C++ code

make
g++ -g --ansi -W -Wall -Wno-unused-parameter -Wno-unused-function -Wno-unneeded-internal-declaration -c Absyn.C
g++ -g --ansi -W -Wall -Wno-unused-parameter -Wno-unused-function -Wno-unneeded-internal-declaration -c Parser.C
Nask.y: In function ‘int nask_parse(yyscan_t, YYSTYPE*)’:
Nask.y:440:27: error: ‘reverse’ is not a member of ‘std’
  440 | Program : ListStmt { std::reverse($1->begin(),$1->end()) ;$$ = new Prog($1); result->program_ = $$; }
@andreasabel andreasabel added C++ parser Issues concerning parser generating labels Aug 26, 2021
@andreasabel
Copy link
Member

andreasabel commented Aug 26, 2021

Apple clang version 11.0.0 (clang-1100.0.33.17) does not need this, but clang isn't always faithful to the standard.

Which version of g++ do you have? What does g++ --version print?

@andreasabel
Copy link
Member

I can reproduce the problem with c++-11 (Homebrew GCC 11.2.0) 11.2.0.

@andreasabel
Copy link
Member

On C++ backend, generated codes should add #include <algorithm>

This was the case until BNFC-2.9.1, so it is a regression I introduced when unifying the bison backends.

@andreasabel andreasabel added the regression in 2.9.2 Regression that first appeared in BNFC 2.9.2 label Aug 26, 2021
@andreasabel andreasabel self-assigned this Aug 26, 2021
@andreasabel andreasabel added this to the 2.9.3 milestone Aug 26, 2021
@hangingman
Copy link
Author

@andreasabel Great, thank you !

@hangingman
Copy link
Author

FYI my g++ version

$ g++ --version
g++ (Debian 10.2.1-6) 10.2.1 20210110
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C++ parser Issues concerning parser generating regression in 2.9.2 Regression that first appeared in BNFC 2.9.2
Projects
None yet
Development

No branches or pull requests

2 participants