bolero-MURAKAMI / Sprout

C++11/14 constexpr based Containers, Algorithms, Random numbers, Parsing, Ray tracing, Synthesizer, and others.
http://bolero-murakami.github.io/Sprout/
Boost Software License 1.0
876 stars 48 forks source link

sprout::io does not work with clang #62

Closed ghost closed 10 years ago

ghost commented 10 years ago

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.

1

Finish

Wandbox: http://melpon.org/wandbox/permlink/0JcuLqvwMbuIf7Bj

bolero-MURAKAMI commented 10 years ago

fixed: fb69a146dda89db33c3b2f65b56c6dacce80b78e

bolero-MURAKAMI commented 10 years ago