Skip to content
Snippets Groups Projects
Commit 771cf169 authored by Ben Cumming's avatar Ben Cumming Committed by GitHub
Browse files

Merge pull request #51 from halfflat/feature/fix-gcc6-optional-warning

Address gcc 6.1 warnings
parents 55cecb9b dfdb4865
No related branches found
No related tags found
No related merge requests found
......@@ -62,7 +62,7 @@ template <typename T>
T
norm(point<T> const& p)
{
return sqrt(p.x*p.x + p.y*p.y + p.z*p.z);
return std::sqrt(p.x*p.x + p.y*p.y + p.z*p.z);
}
template <typename T>
......
......@@ -226,6 +226,13 @@ namespace detail {
template <typename T>
using enable_unless_optional_t = enable_if_t<!is_optional<T>::value>;
// avoid nonnull address warnings when using operator| with e.g. char array constants
template <typename T>
bool decay_bool(const T* x) { return static_cast<bool>(x); }
template <typename T>
bool decay_bool(const T& x) { return static_cast<bool>(x); }
} // namespace detail
template <typename X>
......@@ -398,7 +405,7 @@ typename std::enable_if<
>
>::type
operator|(A&& a,B&& b) {
return a ? a : b;
return detail::decay_bool(a) ? a : b;
}
template <typename A,typename B>
......
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