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

A few tiny changes for C++23—friendliness #79

Merged
merged 2 commits into from
Sep 3, 2024

Conversation

Sonotsugipaa
Copy link
Contributor

I recently tried to use ctpg for a tiny program of mine, which is written in C++23 - it failed to compile due to an operator overload (see 67be52d), and a test failed to compile (see 4ccc849) after that.

I tried to justify the changes within the commit messages, however I'm not entirely sure why those problems weren't problems before my latest system update (especially the second one I fixed).

This change was made in response to a GCC-14.2.1 warning:
a comparison operator in the form `bool T::operator==(const U&)` (note that the function itself is not const)
expects the left operand to be non-const, but as of C++20 can be "reversed" - so that `T{} == U{}` and `U{} == T{}`
may refer to the same operator overload.
Apparently this may break things.

Regardless of the details regarding this warning, it only makes sense for stdex::cbitset::operator== to allow const
operands on both sides, and it is likely the intended behavior.
…ctor

With GCC-14.2.1, compiling with `-std=c++23`: the expression `T{}` seems to expect an explicit default constructor
if T (only) has deleted copy-constructors and defaulted move-constructors.
@Sonotsugipaa Sonotsugipaa marked this pull request as ready for review September 3, 2024 14:17
Copy link
Owner

@peter-winter peter-winter left a comment

Choose a reason for hiding this comment

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

Looks just fine.

@peter-winter peter-winter merged commit 624b4d1 into peter-winter:master Sep 3, 2024
7 checks passed
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.

2 participants