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

Support for constexpr declaration of the Negative values with literals #293

Open
jinay1991 opened this issue Sep 4, 2022 · 1 comment
Open

Comments

@jinay1991
Copy link

jinay1991 commented Sep 4, 2022

It was often required to define certain constants statically and preferably as constexpr, although there are certain times, values may need to be -ve. This is already possible with full declaration of the unit, although does not support alongside the literals. Please see example below:

static constexpr units::angle::radian_t kAngularValue{-30.0_deg};  /// ERROR: Compiler will not find `constexpr`
                                                                   /// definition of the literal to convert deg to
                                                                   /// radian implicitly for negative numbers.

static constexpr units::angle::radian_t kAngularValue = units::angle::degree_t{-30.0};  /// WORKS FINE
static constexpr units::angle::radian_t kAngularValue{30.0_deg};                        /// WORKS FINE

I request the FIX or SUPPORT for such use-case.

Thanks in advance.

Library Version: v2.3.1
Compiler Used: GCC v12, Clang v12

@nholthaus
Copy link
Owner

supported in the 3.0 releases. Consider backporting to 2.3.

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