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

Best conversion selector is not behaving as expected in some scenarios #120

Open
pavel-kirienko opened this issue Apr 29, 2024 · 3 comments
Assignees
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@pavel-kirienko
Copy link
Member

Moving from OpenCyphal-Garage/libcyphal#355

Running ./build-tools/bin/verify.py release on "ts22.4.7" docker image on macOS M2 machine fails with following on line # 104:

static_assert(best_conversion_index_v<std::is_unsigned, long, char, long, unsigned long> == 2, "");
[26/108] Building CXX object suites/unittest/CMakeFiles/test_type_traits_ext__googletest_objlib.dir/test_type_traits_ext.cpp.o
FAILED: suites/unittest/CMakeFiles/test_type_traits_ext__googletest_objlib.dir/test_type_traits_ext.cpp.o
/usr/bin/g++ -DCETL_VERSION=\"1.3.0\" -I/repo/cetlvast/include -I/repo/include -I/repo/cetlvast/build_external/o1heap/o1heap -isystem /repo/cetlvast/build_external/googletest/googletest/include -isystem /repo/cetlvast/build_external/googletest/googletest -isystem /repo/cetlvast/build_external/googletest/googlemock/include -isystem /repo/cetlvast/build_external/googletest/googlemock -g -pedantic -Wall -Wextra -Werror -Wfloat-equal -Wconversion -Wunused-parameter -Wunused-variable -Wunused-value -Wcast-align -Wmissing-declarations -Wmissing-field-initializers -Wdouble-promotion -Wswitch-enum -Wtype-limits -Wno-error=array-bounds -Wsign-conversion -Wsign-promo -Wold-style-cast -Wzero-as-null-pointer-constant -Wnon-virtual-dtor -Woverloaded-virtual -O0 -DDEBUG -ggdb -std=c++14 -MD -MT suites/unittest/CMakeFiles/test_type_traits_ext__googletest_objlib.dir/test_type_traits_ext.cpp.o -MF suites/unittest/CMakeFiles/test_type_traits_ext__googletest_objlib.dir/test_type_traits_ext.cpp.o.d -o suites/unittest/CMakeFiles/test_type_traits_ext__googletest_objlib.dir/test_type_traits_ext.cpp.o -c /repo/cetlvast/suites/unittest/test_type_traits_ext.cpp
/repo/cetlvast/suites/unittest/test_type_traits_ext.cpp:104:90: error: static assertion failed
  104 | static_assert(best_conversion_index_v<std::is_unsigned, long, char, long, unsigned long> == 2, "");
      |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
/repo/cetlvast/suites/unittest/test_type_traits_ext.cpp:104:90: note: the comparison reduces to ‘(18446744073709551615 == 2)’
[28/108] Building CXX object suites/unittest/CMakeFiles/test_pf17_variant_other__googletest_objlib.dir/test_pf17_variant_other.cpp.o
ninja: build stopped: subcommand failed.
root@7b9e4d01cc28:/repo# uname -a
Linux 7b9e4d01cc28 6.6.22-linuxkit #1 SMP Fri Mar 29 12:21:27 UTC 2024 aarch64 aarch64 aarch64 GNU/Linux
@pavel-kirienko
Copy link
Member Author

pavel-kirienko commented Aug 16, 2024

Another one with GCC v7.3.1:

include/cetl/pf17/variant.hpp:723:1: error: static assertion failed: self-test failure
static_assert(best_converting_ctor_index_v<float, long, float, bool> == 1, "self-test failure");
^~~~~~~~~~~~~ 

@pavel-kirienko pavel-kirienko self-assigned this Aug 16, 2024
@pavel-kirienko pavel-kirienko changed the title static_assert(best_conversion_index_v failure on macOS docker Best conversion selector is not behaving as expected in some scenarios Aug 16, 2024
@lydia-at-amazon
Copy link

Some more examples in unit tests with GCC v7.3.1:

cetlvast/suites/unittest/test_type_traits_ext.cpp:115:1: error: static assertion failed
static_assert(best_conversion_index_v<partial<is_convertible_without_narrowing, char>::template type, char, foo, int> ==
^~~~~~~~~~~~~
cetlvast/suites/unittest/test_type_traits_ext.cpp:118:1: error: static assertion failed
static_assert(best_conversion_index_v<partial<is_convertible_without_narrowing, char>::template type, char, foo> == bad,
^~~~~~~~~~~~~ 

@lydia-at-amazon
Copy link

More examples in variant.hpp:

include/cetl/pf17/variant.hpp:724:1: error: static assertion failed: self-test failure
static_assert(best_converting_ctor_index_v<double, long, float, double, bool> == 2, "self-test failure");
^~~~~~~~~~~~~

include/cetl/pf17/variant.hpp:740:1: error: static assertion failed: self-test failure
static_assert(best_converting_assignment_index_v<float, long, float, bool> == 1, "self-test failure");
^~~~~~~~~~~~~

include/cetl/pf17/variant.hpp:741:1: error: static assertion failed: self-test failure
static_assert(best_converting_assignment_index_v<double, long, float, double, bool> == 2, "self-test failure");
^~~~~~~~~~~~~ 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants