sprout::io does not work with clang.
But It may be clang's bug.(because it works with gcc)
If someone has a workaround idea, please apply it.
Following code:
#include <sprout/io.hpp>
int main() {
constexpr auto test = sprout::io::output<32>(sprout::io::root << "test");
}
Output:
Start
prog.cc:4:20: error: constexpr variable 'test' must be initialized by a constant expression
constexpr auto test = sprout::io::output<32>(sprout::io::root << "test");
^ ~~~~~~~~~~
/usr/local/sprout/sprout/utility/value_holder/value_holder.hpp:269:28: note: read of temporary whose lifetime has ended
return helpertype::ref(holder);
^
/usr/local/sprout/sprout/io.hpp:452:12: note: in call to '&sprout::io::leafexpression<char [5]>(rhs).value->operator char const (&)[5]()'
return value_;
^
/usr/local/sprout/sprout/io.hpp:652:7: note: in call to '&sprout::io::leaf_expression<char [5]>(rhs)->value()'
(expr.right().value(), expr.settings());
^
/usr/local/sprout/sprout/io.hpp:679:11: note: in call to 'get_leaf(sprout::io::root << "test")'
return sprout::io::detail::get_leaf(expr);
^
/usr/local/sprout/sprout/io.hpp:784:32: note: in call to 'get_leaf(sprout::io::root << "test")'
sprout::io::eval<Elem, N>(sprout::io::get_leaf(expr))...
^
/usr/local/sprout/sprout/io.hpp:794:11: note: in call to 'output(sprout::io::root << "test", {})'
return sprout::io::detail::output<Elem, N>(
^
prog.cc:4:27: note: in call to 'output(sprout::io::root << "test")'
constexpr auto test = sprout::io::output<32>(sprout::io::root << "test");
^
/usr/local/sprout/sprout/io.hpp:558:11: note: temporary created here
(lhs, sprout::io::leaf_expression(rhs));
^
1 error generated.
sprout::io does not work with clang. But It may be clang's bug.(because it works with gcc) If someone has a workaround idea, please apply it.
Following code:
Output:
prog.cc:4:20: error: constexpr variable 'test' must be initialized by a constant expression constexpr auto test = sprout::io::output<32>(sprout::io::root << "test"); ^
~~~~~~~~~~/usr/local/sprout/sprout/utility/value_holder/value_holder.hpp:269:28: note: read of temporary whose lifetime has ended return helpertype::ref(holder); ^ /usr/local/sprout/sprout/io.hpp:452:12: note: in call to '&sprout::io::leafexpression<char [5]>(rhs).value->operator char const (&)[5]()' return value_; ^ /usr/local/sprout/sprout/io.hpp:652:7: note: in call to '&sprout::io::leaf_expression<char [5]>(rhs)->value()'1
Wandbox: http://melpon.org/wandbox/permlink/0JcuLqvwMbuIf7Bj