Skip to content

Cpu: disable test on C++20 #154

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

Closed
wants to merge 1 commit into from

Conversation

sthalik
Copy link
Contributor

@sthalik sthalik commented Nov 10, 2022

I tried fixing it with operator<=> and then it becomes ambiguous with itself. This prevents me from running the test suite.

The C++20 standard has worsened operator== overload rules with its
automatic operator!= derivation. Some cases that should still be legal
were forcibly made ambiguous.
@codecov
Copy link

codecov bot commented Nov 10, 2022

Codecov Report

Base: 97.96% // Head: 97.96% // No change to project coverage 👍

Coverage data is based on head (d054fc2) compared to base (6f115b2).
Patch has no changes to coverable lines.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #154   +/-   ##
=======================================
  Coverage   97.96%   97.96%           
=======================================
  Files         135      135           
  Lines       10940    10940           
=======================================
  Hits        10717    10717           
  Misses        223      223           

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@mosra
Copy link
Owner

mosra commented Nov 10, 2022

Huh. Which compiler? What does it say?

If it's broken, it's not just the test being broken -- it means any code using the Cpu functionality could run into the same error as well and so I need to fix it properly. It didn't only because there's not that much code using it yet.

@sthalik
Copy link
Contributor Author

sthalik commented Nov 10, 2022

It's clang 15 in C++20 mode. Says operator== is ambiguous.

@mosra mosra added this to the 2022.0a milestone Nov 10, 2022
@mosra
Copy link
Owner

mosra commented Nov 10, 2022

Full error, please. What is it ambiguous with?

Unfortunately I still don't have Clang 15 locally (details) so I can't look into this myself yet, and thus I either need to rely on you as a remote debugger, or you have to wait. Sorry 😅

@sthalik
Copy link
Contributor Author

sthalik commented Nov 10, 2022

[27/38] Building CXX object external/corrade/src/Corrade/Test/CMakeFiles/CpuTest.dir/CpuTest.cpp.obj
FAILED: external/corrade/src/Corrade/Test/CMakeFiles/CpuTest.dir/CpuTest.cpp.obj 
C:\msys64\clang64\bin\c++.exe -DCORRADE_IS_DEBUG_BUILD -DIMGUI_DISABLE_OBSOLETE_FUNCTIONS -DIMGUI_DISABLE_OBSOLETE_KEYIO -DJSON_HAS_THREE_WAY_COMPARISON=1 -DNOMINMAX -DUNICODE -DWIN32_LEAN_AND_MEAN -D_CRT_SECURE_NO_WARNINGS -D_HAS_EXCEPTIONS=0 -D_LIBCPP_ENABLE_ASSERTIONS=1 -D_UNICODE -IF:/dev/game/external/corrade/src -IF:/dev/game/build/external/corrade/src -fuse-cxa-atexit -O0 -g -ggdb -fstack-protector-all -fvisibility=hidden -fvisibility-inlines-hidden -fcolor-diagnostics -emit-llvm -fcolor-diagnostics -Wno-reserved-macro-identifier -Wno-error -Wno-undef -Wno-ignored-attributes -Wno-unused-function -Wno-unused-but-set-variable -Wall -Wextra -Wold-style-cast -Winit-self -Werror=return-type -Wmissing-declarations -Wpedantic -fvisibility=hidden -fvisibility-inlines-hidden -Wmissing-prototypes -Wno-shorten-64-to-32 -Wunused-member-function -Wno-unneeded-member-function -std=c++2b -MD -MT external/corrade/src/Corrade/Test/CMakeFiles/CpuTest.dir/CpuTest.cpp.obj -MF external\corrade\src\Corrade\Test\CMakeFiles\CpuTest.dir\CpuTest.cpp.obj.d -o external/corrade/src/Corrade/Test/CMakeFiles/CpuTest.dir/CpuTest.cpp.obj -c F:/dev/game/external/corrade/src/Corrade/Test/CpuTest.cpp
F:/dev/game/external/corrade/src/Corrade/Test/CpuTest.cpp:577:30: warning: ISO C++20 considers use of overloaded operator '==' (with operand types 'const Corrade::Cpu::Sse3T' and 'const Corrade::Cpu::Sse3T') to be ambiguous despite there being a unique best viable function [-Wambiguous-reversed-operator]
    CORRADE_VERIFY(Cpu::Sse3 == Cpu::Sse3);
                   ~~~~~~~~~ ^  ~~~~~~~~~
F:/dev/game/external/corrade/src/Corrade/TestSuite/Tester.h:1591:69: note: expanded from macro 'CORRADE_VERIFY'
        Corrade::TestSuite::Tester::instance().verify(#__VA_ARGS__, __VA_ARGS__); \
                                                                    ^~~~~~~~~~~
F:/dev/game/external/corrade/src/Corrade/Cpu.h:1528:74: note: ambiguity is between a regular call to this operator and a call with the argument order reversed
template<class T, class = decltype(TypeTraits<T>::Index)> constexpr bool operator==(T a, Features b) {
                                                                         ^
F:/dev/game/external/corrade/src/Corrade/Test/CpuTest.cpp:578:30: error: use of overloaded operator '!=' is ambiguous (with operand types 'const Corrade::Cpu::Sse3T' and 'const Corrade::Cpu::Sse41T')
    CORRADE_VERIFY(Cpu::Sse3 != Cpu::Sse41);
                   ~~~~~~~~~ ^  ~~~~~~~~~~
F:/dev/game/external/corrade/src/Corrade/TestSuite/Tester.h:1591:69: note: expanded from macro 'CORRADE_VERIFY'
        Corrade::TestSuite::Tester::instance().verify(#__VA_ARGS__, __VA_ARGS__); \
                                                                    ^~~~~~~~~~~
F:/dev/game/external/corrade/src/Corrade/Cpu.h:1537:74: note: candidate function [with T = Corrade::Cpu::Sse3T, $1 = Corrade::Cpu::TypeTraits<Corrade::Cpu::Sse3T>::(unnamed enum at F:/dev/game/external/corrade/src/Corrade/Cpu.h:683:5)]
template<class T, class = decltype(TypeTraits<T>::Index)> constexpr bool operator!=(T a, Features b) {
                                                                         ^
F:/dev/game/external/corrade/src/Corrade/Cpu.h:1528:74: note: candidate function [with T = Corrade::Cpu::Sse3T, $1 = Corrade::Cpu::TypeTraits<Corrade::Cpu::Sse3T>::(unnamed enum at F:/dev/game/external/corrade/src/Corrade/Cpu.h:683:5)]
template<class T, class = decltype(TypeTraits<T>::Index)> constexpr bool operator==(T a, Features b) {
                                                                         ^
F:/dev/game/external/corrade/src/Corrade/Cpu.h:1528:74: note: candidate function (with reversed parameter order) [with T = Corrade::Cpu::Sse41T, $1 = Corrade::Cpu::TypeTraits<Corrade::Cpu::Sse41T>::(unnamed enum at F:/dev/game/external/corrade/src/Corrade/Cpu.h:691:5)]
1 warning and 1 error generated.
[28/38] Building CXX object test/CMakeFiles/floormat-test.dir/const-math.cpp.obj
[29/38] Building CXX object editor/CMakeFiles/floormat-editor.dir/imgui.cpp.obj
[30/38] Linking CXX executable DEBUG\bin\floormat-anim-crop-tool.exe
ninja: build stopped: subcommand failed.

@mosra
Copy link
Owner

mosra commented Jan 20, 2023

I have Clang 15 since yesterday (finally!), and this is fixed properly in 507a409. Took me a while to understand what Clang wanted, heh.

@mosra mosra closed this Jan 20, 2023
@sthalik sthalik deleted the pr/cxx20-test-compile branch September 12, 2023 02:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

2 participants