flatbuffers: Missing std includes (cpp codegen)
Looks like flatc doesn’t include the necessary std includes for the code it generates. Soemtimes this is OK because flatbuffers.h is included and gets a few of them, but I’m getting compilation errors with --cpp-static-reflection because it uses std::array<> but never actually includes <array>.
Also looks like it uses std::declval<> without including <type_traits> and std::vector<> without including <vector>. I think the generated files should include everything they need to work properly and not rely on transient includes of stl via flatbuffers.h.
I am using v2.0.0, though I also tried HEAD (d959e232082641fb30dba457085c6bdc97419f4c at the time).
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 15 (3 by maintainers)
I was able to catch the error by explicitly building flatbuffers and it failed only for C++20: (https://github.com/google/flatbuffers/runs/8030662288?check_suite_focus=true). So I don’t even need an explicit test file for this.