r/backtickbot • u/backtickbot • Jun 28 '21
https://np.reddit.com/r/cpp/comments/o8t2h9/its_so_weird_seeing_msvc_support_c20_and_clang/h3dlulk/
Hi arturbac,
I just checked out the project and I notice that we fail to compile it due to some UB with your defined type traits: fixed_lib/include/fixedmath/limits.h This is not allowed by the standard and MSVC takes advantage of this to implement some optimizations.
I was also unable to reproduce the compiler ICE you observed in your static assertion. Here's the output I see:
$ cl -std:c++20 -c -EHsc -Ifixed_math\fixed_lib\include -TP fixed_math\fixed_lib\include\fixedmath\unittests\compile_time_unit_tests.h
E:\Documents\git_projects\fixed_math\fixed_lib\include\fixedmath\unittests\compile_time_unit_tests.h(25): error C2338: dont expect constexpr will work on this broken compiler. Expect cl crash and internal compiler error
E:\Documents\git_projects\fixed_math\fixed_lib\include\fixedmath\unittests\type_traits.h(36): error C2607: static assertion failed
E:\Documents\git_projects\fixed_math\fixed_lib\include\fixedmath\unittests\type_traits.h(37): error C2607: static assertion failed
E:\Documents\git_projects\fixed_math\fixed_lib\include\fixedmath\unittests\unit_test_common.h(35): error C2825: 'T': must be a class or namespace when followed by '::'
E:\Documents\git_projects\fixed_math\fixed_lib\include\fixedmath\unittests\unit_test_common.h(28): note: see reference to class template instantiation 'fixedmath::assert_equal_t<const T,const T>' being compiled
with
[
T=fixedmath::fixed_internal
]
E:\Documents\git_projects\fixed_math\fixed_lib\include\fixedmath\unittests\unit_test_common.h(28): note: while compiling class template member function 'bool fixedmath::assert_equal_t<fixedmath::const_val<fixedmath::fixed_internal,65536>,fixedmath::const_val<fixedmath::fixed_internal,65536>>::eq(void)'
E:\Documents\git_projects\fixed_math\fixed_lib\include\fixedmath\unittests\misc_functions.h(30): note: see reference to class template instantiation 'fixedmath::assert_equal_t<fixedmath::const_val<fixedmath::fixed_internal,65536>,fixedmath::const_val<fixedmath::fixed_internal,65536>>' being compiled
E:\Documents\git_projects\fixed_math\fixed_lib\include\fixedmath\unittests\unit_test_common.h(35): error C2510: 'T': left of '::' must be a class/struct/union
E:\Documents\git_projects\fixed_math\fixed_lib\include\fixedmath\unittests\unit_test_common.h(35): error C2065: 'value': undeclared identifier
E:\Documents\git_projects\fixed_math\fixed_lib\include\fixedmath\unittests\unit_test_common.h(35): error C2825: 'U': must be a class or namespace when followed by '::'
E:\Documents\git_projects\fixed_math\fixed_lib\include\fixedmath\unittests\unit_test_common.h(35): error C2510: 'U': left of '::' must be a class/struct/unionDo you have a different set of options?
0
Upvotes