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

Cannot result in a constant expression errors #52

Open
vladipus opened this issue Apr 23, 2023 · 1 comment
Open

Cannot result in a constant expression errors #52

vladipus opened this issue Apr 23, 2023 · 1 comment

Comments

@vladipus
Copy link

Binary operators like:

template <typename B, typename I, unsigned int F, bool R>
constexpr inline fixed<B, I, F, R> operator+(const fixed<B, I, F, R>& x, const fixed<B, I, F, R>& y) noexcept
{
return fixed<B, I, F, R>(x) += y;
}

are defined as constexpr but the += operator is never constexpr which results in a "cannot result in a constant expression" error.

@serjzimmerman
Copy link

I too encountered this issue. However, it seems intentional to me because this library aims to support C++11 which does not allow operator overloads to be constexpr. I did not look very closely into the code, but I think constexpr could be conditionally enabled for C++14 using version specific macros

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