Skip to content

Use static const for next/prior from C++11#77

Merged
pdimov merged 2 commits intoboostorg:developfrom
ecatmur:next-prior
Jun 18, 2024
Merged

Use static const for next/prior from C++11#77
pdimov merged 2 commits intoboostorg:developfrom
ecatmur:next-prior

Conversation

@ecatmur
Copy link
Copy Markdown
Contributor

@ecatmur ecatmur commented Nov 24, 2023

Trying to form next/prior in constant evaluation may be ill-formed. Fixes #69.

Trying to form next/prior in constant evaluation may be ill-formed; see boostorg#69
// either
#if BOOST_WORKAROUND(__EDG_VERSION__, <= 243)
#if BOOST_WORKAROUND(__EDG_VERSION__, <= 243) \
|| __cplusplus >= 201703L
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I believe the warning is active from C++11 and onwards.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Changed, thanks. I was following someone's comment here llvm/llvm-project#50055 (comment) ;)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Yep, technically this has moved from "unspecified behavior" in <=C++14 to "undefined behavior" in C++17 onwards. But the LLVM implementation warns starting on C++11. Not sure what the correct behavior would be (is there any?), but that's how it works today :)

https://github.com/llvm/llvm-project/pull/67528/files#diff-24549b124046a492279fe53ffe2aca86550f281b025a48067c043a1c944547faR3

Apply change since C++11
@ecatmur ecatmur changed the title Use static const for next/prior from C++17 Use static const for next/prior from C++11 Nov 27, 2023
@pdimov pdimov closed this Jun 17, 2024
@pdimov pdimov reopened this Jun 17, 2024
@pdimov pdimov merged commit b37b709 into boostorg:develop Jun 18, 2024
ktrushin pushed a commit to percona/percona-server-mongodb that referenced this pull request Nov 2, 2024
Trying to form next/prior in constant evaluation may be ill-formed; see boostorg/mpl#69

Note: the patch source is
boostorg/mpl#77

Please also see boostorg/mpl#69
ktrushin pushed a commit to percona/percona-server-mongodb that referenced this pull request Nov 4, 2024
Trying to form next/prior in constant evaluation may be ill-formed; see boostorg/mpl#69

Note: the patch source is
boostorg/mpl#77

Please also see boostorg/mpl#69
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.

boost::mpl::integral_c broken in Clang trunk

3 participants