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

expression did not evaluate to a constant #321

Open
StrikeByte opened this issue Nov 15, 2023 · 4 comments
Open

expression did not evaluate to a constant #321

StrikeByte opened this issue Nov 15, 2023 · 4 comments

Comments

@StrikeByte
Copy link

The initialization of the time constants can lead to the following error when using msvc2019 "expression did not evaluate to a constant"
when parentheses are replaced with curly brackets the problem does not occur

unit_definitions.hpp
namespace time {
constexpr precise_unit min{60.0, s}; //this fixes the problem for me
constexpr precise_unit ms{0.001, s};
constexpr precise_unit ns{1e-9, s};
constexpr precise_unit hr{60.0, min};
constexpr precise_unit h{60.0, min};
constexpr precise_unit day{24.0, hr};
constexpr precise_unit week{7.0, day};
constexpr precise_unit yr{8760.0, hr}; // median calendar year;
constexpr precise_unit fortnight{14, day};
...

@phlptp
Copy link
Collaborator

phlptp commented Nov 15, 2023

what compiler settings are you using that lead to the error? We should change those to use brackets and I will soon, but I regularly compile and test on visual studio 2019 and have never see any issue, so I would like to understand the settings that led to an issue on your system.

@StrikeByte
Copy link
Author

The build setup I use is Qt 6.5.1 MSVC2019 x64 (debug build) with cmake
I don't think it is compiler setting specific. The project did build before I included the units into another library of the project.

The build settings are default Qt settings

@phlptp
Copy link
Collaborator

phlptp commented Nov 16, 2023

Are you using main or the latest release?

@phlptp phlptp mentioned this issue Nov 16, 2023
@phlptp
Copy link
Collaborator

phlptp commented Dec 2, 2023

@StrikeByte have you tried again with the current main branch after the #322 merge?

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