-
-
Notifications
You must be signed in to change notification settings - Fork 24
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
Clang C++20 compatibility: made operator== and operator!= friend functions #31
base: master
Are you sure you want to change the base?
Conversation
What about gcc? Is it really somthing the standard added in c++20? Declaring == operator as a member was a common thing, this would break a lot of code. Can you point me to some article explaining the change? |
I didn't try anything yet with gcc as it doesn't support constexpr virtual destructors and I'm using them. I may be able to find a minimal example to reproduce the error I'm trying to fix.
https://en.cppreference.com/w/cpp/language/default_comparisons |
But I'm not using default comparisons here. These are just custom comparisons. |
Any progress on this issue? |
Not yet, I'm busy with non-literal type compatibility at the moment. I will spend more time on that issue later and try to find better explanations. |
I found these issues on the clang bug tracker: https://bugs.llvm.org/show_bug.cgi?id=43765 So it might just be a Clang issue as you said. So far turning the |
…ang C++20 compatibility
…enerate in C++20 mode
Here is an example error message prior to this fix which I got using Clang 13.0.0 with
-std=c++20
:The way I understand it from explanations by @jfalcou (who suggested this fix to me) is that C++20 generates a
friend operator==
by default which is ambiguous with the one provided by ctpg.This commit fixes that by providing
operator==
as a friend function rather than a member function, therefore avoiding any ambiguity.friend operator!=
is also provided after this commit.Correct me if I'm wrong however.
Regards,
Jules