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

[tests, Fatbuffers, v2.0.7] Building tests fails with GCC 4.8.5 #7465

Closed
flukeborder opened this issue Aug 23, 2022 · 3 comments
Closed

[tests, Fatbuffers, v2.0.7] Building tests fails with GCC 4.8.5 #7465

flukeborder opened this issue Aug 23, 2022 · 3 comments

Comments

@flukeborder
Copy link

Building Flatbuffers tests v2.0.7 with GCC 4.8.5 (CentOS 7) fails with a series of errors pertaining to the initialiser list / explicit constructor. One example:

.../flatbuffers/tests/test.cpp: In function ‘void {anonymous}::UtilConvertCase()’: .../flatbuffers/tests/test.cpp:1509:9: error: converting to ‘std::tuple<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, flatbuffers::Case, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >’ from initializer list would use explicit constructor ‘constexpr std::tuple< <template-parameter-1-1> >::tuple(_UElements&& ...) [with _UElements = {const char (&)[20], flatbuffers::Case, const char (&)[17]}; <template-parameter-2-2> = void; _Elements = {std::basic_string<char, std::char_traits<char>, std::allocator<char> >, flatbuffers::Case, std::basic_string<char, std::char_traits<char>, std::allocator<char> >}]’ };

It appears that the tests are written using the initialiser list sytax compatible with C++14 standard library and above, and not the one compatible with C++11.

See e.g. https://stackoverflow.com/questions/26947704/implicit-conversion-failure-from-initializer-list

@dbaileychess
Copy link
Collaborator

Thanks, Looks like we need CI for gcc with --std=c++11 explicitly set. Most users are probably compiling with a later standard and don't have the error.

@flukeborder
Copy link
Author

You might consider being more strict regarding the C++ standard to be used by the individual targets - that is, using the CMAKE_CXX_STANDARD approach rather than the "compiler features" approach (the former translates to --std=c++11 with GCC).
The "compiler features" approach is more suitable for an "end user project", whereas Flatbuffers is a rather special case - it's not even a library, but more of a compile-time code generation utility.
Obviously, you want the generated Flatbuffers C++ code to conform to the specific C++ standard, in order to establish the minimum C++ standard required for projects that use Flatbuffers. In the view of that, it makes sense to force a specific standard (i.e. not to allow a higher standard) for the test targets. CMAKE_CXX_STANDARD can be defined on a target-per-target basis, so having C++17-specific tests should not be an issue.

@dbaileychess
Copy link
Collaborator

This should be fixed by #7487, since I ran into that issue while refactoring.

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

No branches or pull requests

2 participants