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

fix redundant redeclaration of ‘constexpr’ static data member #3630

Merged
merged 1 commit into from
Sep 8, 2023

Conversation

cyyever
Copy link
Contributor

@cyyever cyyever commented Sep 8, 2023

No description provided.

Comment on lines -339 to -340
template <typename CodeUnit>
constexpr const size_t codecvt_result<CodeUnit>::max_size;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest:

#if FMT_CPLUSPLUS < 201703L
template <typename CodeUnit>
constexpr const size_t codecvt_result<CodeUnit>::max_size;
#endif

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer avoiding conditional compilation if possible.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vitaut
This is C++ :(

https://en.cppreference.com/w/cpp/language/static#Static_data_members

If a const non-inline (since C++17) static data member or a constexpr static data member (since C++11)(until C++17) is odr-used, a definition at namespace scope is still required, but it cannot have an initializer.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But it doesn't need to be ODR-used so it should be fine.

@vitaut vitaut merged commit a4b7b24 into fmtlib:master Sep 8, 2023
40 checks passed
@vitaut
Copy link
Contributor

vitaut commented Sep 8, 2023

Thanks!

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

Successfully merging this pull request may close these issues.

3 participants