Unverified Commit 59a2954a authored by Paul Fultz II's avatar Paul Fultz II Committed by GitHub
Browse files

Fix compile errors with ubuntu 20.04 (#880)

* Add build for ubuntu 20.04

* Fix ambiguous overload resolution with stream

* Fix warning

* Capture by value

* Format
parent c2d7c96e
...@@ -147,6 +147,7 @@ jobs: ...@@ -147,6 +147,7 @@ jobs:
os: os:
- ubuntu-16.04 - ubuntu-16.04
- ubuntu-18.04 - ubuntu-18.04
- ubuntu-20.04
configuration: configuration:
- debug - debug
- release - release
......
...@@ -626,7 +626,8 @@ auto tree(M main_op, Ms... ms) ...@@ -626,7 +626,8 @@ auto tree(M main_op, Ms... ms)
if(idx != leafs.size()) if(idx != leafs.size())
return nullopt; return nullopt;
// Use explicit captures to workaround ICE on gcc // Use explicit captures to workaround ICE on gcc
bool found = sequence_c<sizeof...(Ms)>([&ms..., &ctx, &leafs](auto... is) { // Capture by value to workaround compile error on gcc 9
bool found = sequence_c<sizeof...(Ms)>([ms..., &ctx, &leafs](auto... is) {
return fold(lazy_and{})(ctx.lazy_match(ms, leafs[is])...)(); return fold(lazy_and{})(ctx.lazy_match(ms, leafs[is])...)();
}); });
if(not found) if(not found)
......
...@@ -83,8 +83,8 @@ struct function ...@@ -83,8 +83,8 @@ struct function
} }
}; };
template <class Iterator> template <class Stream, class Iterator>
inline std::ostream& stream_range(std::ostream& s, Iterator start, Iterator last) inline Stream& stream_range(Stream& s, Iterator start, Iterator last)
{ {
if(start != last) if(start != last)
{ {
...@@ -94,22 +94,15 @@ inline std::ostream& stream_range(std::ostream& s, Iterator start, Iterator last ...@@ -94,22 +94,15 @@ inline std::ostream& stream_range(std::ostream& s, Iterator start, Iterator last
return s; return s;
} }
inline std::ostream& operator<<(std::ostream& s, std::nullptr_t) template <class Stream>
inline Stream& operator<<(Stream& s, std::nullptr_t)
{ {
s << "nullptr"; s << "nullptr";
return s; return s;
} }
template <class T> template <class Stream, class Range>
inline std::ostream& operator<<(std::ostream& s, const std::vector<T>& v) inline auto operator<<(Stream& s, const Range& v) -> decltype(stream_range(s, v.begin(), v.end()))
{
s << "{ ";
stream_range(s, v.begin(), v.end());
s << "}";
return s;
}
inline std::ostream& operator<<(std::ostream& s, const std::vector<bool>& v)
{ {
s << "{ "; s << "{ ";
stream_range(s, v.begin(), v.end()); stream_range(s, v.begin(), v.end());
......
...@@ -27,7 +27,7 @@ std::future<typename std::result_of<Function()>::type> detach_async(Function&& f ...@@ -27,7 +27,7 @@ std::future<typename std::result_of<Function()>::type> detach_async(Function&& f
std::packaged_task<result_type()> task(std::forward<Function>(f)); std::packaged_task<result_type()> task(std::forward<Function>(f));
auto fut = task.get_future(); auto fut = task.get_future();
std::thread(std::move(task)).detach(); std::thread(std::move(task)).detach();
return std::move(fut); return fut;
} }
return std::async(std::launch::deferred, std::forward<Function>(f)); return std::async(std::launch::deferred, std::forward<Function>(f));
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment