Экспериментируя с boost::hana
(версия 1.1.0) и при компиляции с g ++ 6.2.0 я получаю ошибку компилятора с этим примером:
#include <boost/hana.hpp>
#include <iostream>
#include <type_traits>
struct my_tag {};
namespace boost {
namespace hana {
template<class T>
struct tag_of<T, when<std::is_same<T, int>{}> >
{
using type = my_tag;
};
}
}
int main()
{
std::cout << std::is_same<my_tag,
boost::hana::tag_of<int>::type>::value
<< std::endl;
}
И компилятор генерирует внутреннюю ошибку:
In file included from /usr/local/include/boost/hana/concept/struct.hpp:18:0,
from /usr/local/include/boost/hana/accessors.hpp:15,
from /usr/local/include/boost/hana.hpp:58,
from main.cpp:1:
/usr/local/include/boost/hana/core/tag_of.hpp: In instantiation of ‘struct boost::hana::tag_of<int>’:
main.cpp:21:63: required from here
/usr/local/include/boost/hana/core/tag_of.hpp:22:12: internal compiler error: in unify, at cp/pt.c:20188
struct tag_of : tag_of<T, when<true>> { };
^~~~~~
0x61cda8 unify
../../src/gcc/cp/pt.c:20188
0x61d094 unify
../../src/gcc/cp/pt.c:19980
0x61cadf unify
../../src/gcc/cp/pt.c:20059
0x61d094 unify
../../src/gcc/cp/pt.c:19980
0x61de46 get_partial_spec_bindings
../../src/gcc/cp/pt.c:20749
0x61a69c most_specialized_partial_spec
../../src/gcc/cp/pt.c:21021
0x625123 instantiate_class_template_1
../../src/gcc/cp/pt.c:9812
0x625123 instantiate_class_template(tree_node*)
../../src/gcc/cp/pt.c:10377
0x686c8d complete_type(tree_node*)
../../src/gcc/cp/typeck.c:131
0x686d2f complete_type_or_maybe_complain(tree_node*, tree_node*, int)
../../src/gcc/cp/typeck.c:143
0x5ef539 xref_basetypes(tree_node*, tree_node*)
../../src/gcc/cp/decl.c:12933
0x6253f5 instantiate_class_template_1
../../src/gcc/cp/pt.c:9966
0x6253f5 instantiate_class_template(tree_node*)
../../src/gcc/cp/pt.c:10377
0x686c8d complete_type(tree_node*)
../../src/gcc/cp/typeck.c:131
0x665463 cp_parser_nested_name_specifier_opt
../../src/gcc/cp/parser.c:6104
0x663401 cp_parser_simple_type_specifier
../../src/gcc/cp/parser.c:16255
0x65fcad cp_parser_type_specifier
../../src/gcc/cp/parser.c:15936
0x661f52 cp_parser_type_specifier_seq
../../src/gcc/cp/parser.c:20059
0x66a662 cp_parser_type_id_1
../../src/gcc/cp/parser.c:19921
0x66a77e cp_parser_template_type_arg
../../src/gcc/cp/parser.c:19980
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <file:///usr/share/doc/gcc-6/README.Bugs> for instructions.
Это ошибка GCC? Кто-нибудь может попытаться повторить эту ошибку?
Задача ещё не решена.
Других решений пока нет …