Created
March 2, 2023 04:37
-
-
Save eao197/8e5524eb8b0e6688e310d34492d9267a to your computer and use it in GitHub Desktop.
Примеры сообщений об ошибках для разных реализаций tagged_value_t
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Источник: https://eao197.blogspot.com/2023/03/progc-taggedvaluet.html | |
Компилятор clang 14.0.6. | |
Объемная версия на базе SFINAE: | |
----- | |
$ clang++-14 -std=c++17 -pedantic -Wall -o t1_clang14 t1.cpp | |
t1.cpp:198:24: error: overload resolution selected deleted operator '<' | |
const auto cr = (bin1 < bin2); | |
~~~~ ^ ~~~~ | |
t1.cpp:94:1: note: candidate function [with V = my_data, Tag = binary_tag] has been explicitly deleted | |
operator<( const tagged_value_t<V, Tag> & a, const tagged_value_t<V, Tag> & b ) = delete; | |
^ | |
t1.cpp:83:1: note: candidate template ignored: requirement 'tagged_value_impl::has_less_then_comparison_v_fn<my_data, void>::value' was not satisfied [with V = my_data, Tag = binary_tag] | |
operator<( const tagged_value_t<V, Tag> & a, const tagged_value_t<V, Tag> & b ) | |
^ | |
t1.cpp:199:24: error: overload resolution selected deleted operator '==' | |
const auto er = (bin1 == bin2); | |
~~~~ ^ ~~~~ | |
t1.cpp:112:1: note: candidate function [with V = my_data, Tag = binary_tag] has been explicitly deleted | |
operator==( const tagged_value_t<V, Tag> & a, const tagged_value_t<V, Tag> & b ) = delete; | |
^ | |
t1.cpp:101:1: note: candidate template ignored: requirement 'tagged_value_impl::has_equal_to_comparison_v_fn<my_data, void>::value' was not satisfied [with V = my_data, Tag = binary_tag] | |
operator==( const tagged_value_t<V, Tag> & a, const tagged_value_t<V, Tag> & b ) | |
^ | |
2 errors generated. | |
----- | |
Компактная версия без SFINAE: | |
----- | |
$ clang++-14 -std=c++17 -pedantic -Wall -o t2_clang14 t2.cpp | |
t2.cpp:132:24: error: invalid operands to binary expression ('my_binaries_t' (aka 'tagged_value_t<my_data, binary_tag>') and 'my_binaries_t') | |
const auto er = (bin1 == bin2); | |
~~~~ ^ ~~~~ | |
t2.cpp:52:1: note: candidate template ignored: substitution failure [with V = my_data, Tag = binary_tag]: invalid operands to binary expression ('const my_data' and 'const my_data') | |
operator==( const tagged_value_t<V, Tag> & a, const tagged_value_t<V, Tag> & b ) | |
^ | |
In file included from t2.cpp:1: | |
In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/iostream:39: | |
In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/ostream:38: | |
In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/ios:42: | |
In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/ios_base.h:41: | |
In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/locale_classes.h:40: | |
In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/string:48: | |
/usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/stl_function.h:386:20: error: invalid operands to binary expression ('const my_data' and 'const my_data') | |
{ return __x < __y; } | |
~~~ ^ ~~~ | |
t2.cpp:46:9: note: in instantiation of member function 'std::less<my_data>::operator()' requested here | |
return std::less<V>{}( a.value(), b.value() ); | |
^ | |
t2.cpp:131:24: note: in instantiation of function template specialization 'operator<<my_data, binary_tag>' requested here | |
const auto cr = (bin1 < bin2); | |
^ | |
/usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/stl_pair.h:489:5: note: candidate template ignored: could not match 'const pair<_T1, _T2>' against 'const my_data' | |
operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | |
^ | |
/usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/stl_iterator.h:422:5: note: candidate template ignored: could not match 'const reverse_iterator<_Iterator>' against 'const my_data' | |
operator<(const reverse_iterator<_Iterator>& __x, | |
^ | |
/usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/stl_iterator.h:461:5: note: candidate template ignored: could not match 'const reverse_iterator<_IteratorL>' against 'const my_data' | |
operator<(const reverse_iterator<_IteratorL>& __x, | |
^ | |
/usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/stl_iterator.h:1557:5: note: candidate template ignored: could not match 'const move_iterator<_IteratorL>' against 'const my_data' | |
operator<(const move_iterator<_IteratorL>& __x, | |
^ | |
/usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/stl_iterator.h:1613:5: note: candidate template ignored: could not match 'const move_iterator<_Iterator>' against 'const my_data' | |
operator<(const move_iterator<_Iterator>& __x, | |
^ | |
t2.cpp:42:1: note: candidate template ignored: could not match 'const tagged_value_t<V, Tag>' against 'const my_data' | |
operator<( const tagged_value_t<V, Tag> & a, const tagged_value_t<V, Tag> & b ) | |
^ | |
2 errors generated. | |
----- | |
----- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment