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

Can not build with GCC 9/11+ #4

Closed
geoyee opened this issue Sep 10, 2024 · 3 comments
Closed

Can not build with GCC 9/11+ #4

geoyee opened this issue Sep 10, 2024 · 3 comments

Comments

@geoyee
Copy link

geoyee commented Sep 10, 2024

Hi, when i build this project by cmake (WSL2 and GCC 9/11+), i get some errors :

[build] In file included from /home/user/schwarzwald/schwarzwald/util/./logging/Journal.h:5,
[build]                  from /home/user/schwarzwald/schwarzwald/core/process/Tiler.cpp:8:
[build] /home/user/schwarzwald/schwarzwald/util/./logging/Journal.h: In instantiation of ‘constexpr bool logging::detail::is_flat_trivial_type() [with T = ThroughputStats]’:
[build] /home/user/schwarzwald/schwarzwald/util/./logging/Journal.h:502:74:   required from ‘constexpr const bool logging::IsFlatTrivialType<ThroughputStats>’
[build] /home/user/schwarzwald/schwarzwald/util/./logging/Journal.h:891:17:   required from ‘logging::JournalBuilderWithType<logging::VectorStorage<T> > logging::JournalBuilder::with_flat_type() [with T = ThroughputStats]’
[build] /home/user/schwarzwald/schwarzwald/core/process/Tiler.cpp:112:39:   required from here
[build] /home/user/schwarzwald/schwarzwald/util/./logging/Journal.h:425:55:   in ‘constexpr’ expansion of ‘refl::members_of<ThroughputStats>()’
[build] /home/user/schwarzwald/schwarzwald/util/./types/MembersOf.h:116:43:   in ‘constexpr’ expansion of ‘refl::detail::members_of_aggregate<ThroughputStats>()’
[build] /home/user/schwarzwald/schwarzwald/util/./types/MembersOf.h:57:16: error: ‘reinterpret_cast’ is not a constant expression
[build]    57 |     T* dummy = reinterpret_cast<T*>(&mem);
[build]       |                ^~~~~~~~~~~~~~~~~~~~~~~~~~
[build] In file included from /home/user/schwarzwald/schwarzwald/core/process/Tiler.cpp:8:
[build] /home/user/schwarzwald/schwarzwald/util/./logging/Journal.h: In instantiation of ‘logging::JournalBuilderWithType<logging::VectorStorage<T> > logging::JournalBuilder::with_flat_type() [with T = ThroughputStats]’:
[build] /home/user/schwarzwald/schwarzwald/core/process/Tiler.cpp:112:39:   required from here
[build] /home/user/schwarzwald/schwarzwald/util/./logging/Journal.h:891:17: error: non-constant condition for static assertion
[build]   891 |   static_assert(IsFlatTrivialType<T>,
[build]       |                 ^~~~~~~~~~~~~~~~~~~~
[build] gmake[2]: *** [schwarzwald/core/CMakeFiles/SchwarzwaldCore.dir/build.make:426: schwarzwald/core/CMakeFiles/SchwarzwaldCore.dir/process/Tiler.cpp.o] Error 1
[build] gmake[1]: *** [CMakeFiles/Makefile2:1611: schwarzwald/core/CMakeFiles/SchwarzwaldCore.dir/all] Error 2
[build] gmake: *** [Makefile:136: all] Error 2

I found this to be the wrong way to use, we should not use reinterpret_cast in constexpr function, but i know this project compiles on GCC 7+ and successfully. If i want to use GCC 9/11+, what should i do?

Thank you!

@tobias93
Copy link
Collaborator

Hi,
thanks for the issue. I'll get back to you once I had a chance to look at it. Probably in the next few days or next week.

@geoyee
Copy link
Author

geoyee commented Sep 11, 2024

Hi, thanks for the issue. I'll get back to you once I had a chance to look at it. Probably in the next few days or next week.

Thanks, looking forward to your reply~

@tobias93
Copy link
Collaborator

If you try out the latest commit on master, it should now compile with an up-to-date version of GCC again.

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