Tried to build the "Motivating Example"s.
C++14 example was okay with gcc-6.
C++14 example and C++17 example did not compile with gcc-7 and clang-4.
Note:
gcc (Ubuntu 7-20170407-0ubuntu2) 7.0.1 20170407 (experimental) [trunk revision 246759]
clang version 4.0.0-1ubuntu1 (tags/RELEASE_400/rc1)
C++14 example compiler errors (gcc 7):
gcc.compile.c++ bin/gcc-7/release/source/test_magic.o
In file included from /home/mike/workspace/magic_get/include/boost/pfr/detail/core17.hpp:11:0,
from /home/mike/workspace/magic_get/include/boost/pfr/precise/core.hpp:20,
from /home/mike/workspace/magic_get/include/boost/pfr/precise.hpp:12,
from /home/mike/workspace/magic_get/include/boost/pfr.hpp:12,
from source/test_magic.cpp:9:
/home/mike/workspace/magic_get/include/boost/pfr/detail/core17_generated.hpp: In instantiation of ‘constexpr auto boost::pfr::detail::as_tuple_impl(T&&, boost::pfr::detail::size_t_<3>) [with T = const my_struct&; boost::pfr::detail::size_t_<3> = std::integral_constant<long unsigned int, 3>]’:
/home/mike/workspace/magic_get/include/boost/pfr/detail/core17_generated.hpp:1032:43: required from ‘constexpr auto boost::pfr::detail::as_tuple(const T&) [with T = my_struct]’
/home/mike/workspace/magic_get/include/boost/pfr/precise/io.hpp:45:69: required from ‘void boost::pfr::write(std::basic_ostream<_CharT, _Traits>&, const T&) [with Char = char; Traits = std::char_traits<char>; T = my_struct]’
/home/mike/workspace/magic_get/include/boost/pfr/precise/ops.hpp:129:26: required from ‘boost::pfr::detail::enable_not_ostreamable_t<std::basic_ostream<_CharT, _Traits>, T> boost::pfr::ops::operator<<(std::basic_ostream<_CharT, _Traits>&, const T&) [with Char = char; Traits = std::char_traits<char>; T = my_struct; boost::pfr::detail::enable_not_ostreamable_t<std::basic_ostream<_CharT, _Traits>, T> = std::basic_ostream<char>&]’
source/test_magic.cpp:22:27: required from here
/home/mike/workspace/magic_get/include/boost/pfr/detail/core17_generated.hpp:57:9: error: ‘std::tuple_size<const my_struct>::value’ is not an integral constant expression
auto& [a,b,c] = std::forward<T>(val);
^~~~~~~
In file included from /home/mike/workspace/magic_get/include/boost/pfr/precise/ops.hpp:15:0,
from /home/mike/workspace/magic_get/include/boost/pfr/precise.hpp:14,
from /home/mike/workspace/magic_get/include/boost/pfr.hpp:12,
from source/test_magic.cpp:9:
/home/mike/workspace/magic_get/include/boost/pfr/precise/io.hpp: In instantiation of ‘void boost::pfr::write(std::basic_ostream<_CharT, _Traits>&, const T&) [with Char = char; Traits = std::char_traits<char>; T = my_struct]’:
/home/mike/workspace/magic_get/include/boost/pfr/precise/ops.hpp:129:26: required from ‘boost::pfr::detail::enable_not_ostreamable_t<std::basic_ostream<_CharT, _Traits>, T> boost::pfr::ops::operator<<(std::basic_ostream<_CharT, _Traits>&, const T&) [with Char = char; Traits = std::char_traits<char>; T = my_struct; boost::pfr::detail::enable_not_ostreamable_t<std::basic_ostream<_CharT, _Traits>, T> = std::basic_ostream<char>&]’
source/test_magic.cpp:22:27: required from here
/home/mike/workspace/magic_get/include/boost/pfr/precise/io.hpp:45:47: error: invalid use of void expression
detail::print_impl<0, fields_count>::print(out, detail::as_tuple(value));
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"g++" -ftemplate-depth-128 -march=native -ftemplate-depth=256 -std=c++17 -O3 -finline-functions -Wno-inline -Wall -fPIC -DBOOST_ALL_DYN_LINK -DNDEBUG -I"/home/mike/workspace/magic_get/include" -I"include" -c -o "bin/gcc-7/release/source/test_magic.o" "source/test_magic.cpp"
...failed gcc.compile.c++ bin/gcc-7/release/source/test_magic.o...
C++17 example compiler errors (gcc-7):
gcc.compile.c++ bin/gcc-7/release/source/test_magic.o
In file included from /home/mike/workspace/magic_get/include/boost/pfr/detail/core17.hpp:11:0,
from /home/mike/workspace/magic_get/include/boost/pfr/precise/core.hpp:20,
from /home/mike/workspace/magic_get/include/boost/pfr/precise.hpp:12,
from /home/mike/workspace/magic_get/include/boost/pfr.hpp:12,
from source/test_magic.cpp:9:
/home/mike/workspace/magic_get/include/boost/pfr/detail/core17_generated.hpp: In instantiation of ‘constexpr auto boost::pfr::detail::as_tuple_impl(T&&, boost::pfr::detail::size_t_<2>) [with T = const my_struct&; boost::pfr::detail::size_t_<2> = std::integral_constant<long unsigned int, 2>]’:
/home/mike/workspace/magic_get/include/boost/pfr/detail/core17_generated.hpp:1032:43: required from ‘constexpr auto boost::pfr::detail::as_tuple(const T&) [with T = my_struct]’
/home/mike/workspace/magic_get/include/boost/pfr/precise/io.hpp:45:69: required from ‘void boost::pfr::write(std::basic_ostream<_CharT, _Traits>&, const T&) [with Char = char; Traits = std::char_traits<char>; T = my_struct]’
/home/mike/workspace/magic_get/include/boost/pfr/precise/ops.hpp:129:26: required from ‘boost::pfr::detail::enable_not_ostreamable_t<std::basic_ostream<_CharT, _Traits>, T> boost::pfr::ops::operator<<(std::basic_ostream<_CharT, _Traits>&, const T&) [with Char = char; Traits = std::char_traits<char>; T = my_struct; boost::pfr::detail::enable_not_ostreamable_t<std::basic_ostream<_CharT, _Traits>, T> = std::basic_ostream<char>&]’
source/test_magic.cpp:21:27: required from here
/home/mike/workspace/magic_get/include/boost/pfr/detail/core17_generated.hpp:51:9: error: ‘std::tuple_size<const my_struct>::value’ is not an integral constant expression
auto& [a,b] = std::forward<T>(val);
^~~~~
In file included from /home/mike/workspace/magic_get/include/boost/pfr/precise/ops.hpp:15:0,
from /home/mike/workspace/magic_get/include/boost/pfr/precise.hpp:14,
from /home/mike/workspace/magic_get/include/boost/pfr.hpp:12,
from source/test_magic.cpp:9:
/home/mike/workspace/magic_get/include/boost/pfr/precise/io.hpp: In instantiation of ‘void boost::pfr::write(std::basic_ostream<_CharT, _Traits>&, const T&) [with Char = char; Traits = std::char_traits<char>; T = my_struct]’:
/home/mike/workspace/magic_get/include/boost/pfr/precise/ops.hpp:129:26: required from ‘boost::pfr::detail::enable_not_ostreamable_t<std::basic_ostream<_CharT, _Traits>, T> boost::pfr::ops::operator<<(std::basic_ostream<_CharT, _Traits>&, const T&) [with Char = char; Traits = std::char_traits<char>; T = my_struct; boost::pfr::detail::enable_not_ostreamable_t<std::basic_ostream<_CharT, _Traits>, T> = std::basic_ostream<char>&]’
source/test_magic.cpp:21:27: required from here
/home/mike/workspace/magic_get/include/boost/pfr/precise/io.hpp:45:47: error: invalid use of void expression
detail::print_impl<0, fields_count>::print(out, detail::as_tuple(value));
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"g++" -ftemplate-depth-128 -march=native -ftemplate-depth=256 -std=c++17 -O3 -finline-functions -Wno-inline -Wall -fPIC -DBOOST_ALL_DYN_LINK -DNDEBUG -I"/home/mike/workspace/magic_get/include" -I"include" -c -o "bin/gcc-7/release/source/test_magic.o" "source/test_magic.cpp"
...failed gcc.compile.c++ bin/gcc-7/release/source/test_magic.o...
C++17 example compiler errors (clang-4):
clang-linux.compile.c++.without-pth bin/clang-linux-4.0.0/release/source/test_magic.o
In file included from source/test_magic.cpp:9:
In file included from /home/mike/workspace/magic_get/include/boost/pfr.hpp:12:
In file included from /home/mike/workspace/magic_get/include/boost/pfr/precise.hpp:12:
In file included from /home/mike/workspace/magic_get/include/boost/pfr/precise/core.hpp:20:
In file included from /home/mike/workspace/magic_get/include/boost/pfr/detail/core17.hpp:11:
/home/mike/workspace/magic_get/include/boost/pfr/detail/core17_generated.hpp:51:9: error: cannot decompose this type; 'std::tuple_size<const my_struct>::value' is not a valid integral constant expression
auto& [a,b] = std::forward<T>(val);
^
/home/mike/workspace/magic_get/include/boost/pfr/detail/core17_generated.hpp:1032:30: note: in instantiation of function template specialization 'boost::pfr::detail::as_tuple_impl<const my_struct &>' requested here
return boost::pfr::detail::as_tuple_impl(val, fields_count_tag{});
^
/home/mike/workspace/magic_get/include/boost/pfr/precise/io.hpp:45:61: note: in instantiation of function template specialization 'boost::pfr::detail::as_tuple<my_struct>' requested here
detail::print_impl<0, fields_count>::print(out, detail::as_tuple(value));
^
/home/mike/workspace/magic_get/include/boost/pfr/precise/ops.hpp:129:21: note: in instantiation of function template specialization 'boost::pfr::write<char, std::char_traits<char>, my_struct>' requested here
boost::pfr::write(out, value);
^
source/test_magic.cpp:21:24: note: in instantiation of function template specialization 'boost::pfr::ops::operator<<<char, std::char_traits<char>, my_struct>' requested here
<< " fields: " << s << "\n";
^
4 errors generated.
"clang++" -c -x c++ -march=native -std=c++1z -O3 -Wno-inline -Wall -fPIC -DBOOST_ALL_DYN_LINK -DNDEBUG -I"/home/mike/workspace/magic_get/include" -I"include" -o "bin/clang-linux-4.0.0/release/source/test_magic.o" "source/test_magic.cpp"
...failed clang-linux.compile.c++.without-pth bin/clang-linux-4.0.0/release/source/test_magic.o...