From: Jacob Lifshay Date: Wed, 5 Jul 2017 06:06:40 +0000 (-0700) Subject: modify variant to improve clang's diagnostics X-Git-Tag: gsoc-2017~73^2~9 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=dc900b572ed31fbf374de4dc14bdbe19d50ab0f5;p=kazan.git modify variant to improve clang's diagnostics --- diff --git a/src/util/variant.h b/src/util/variant.h index 288ac14..0ef2e1c 100644 --- a/src/util/variant.h +++ b/src/util/variant.h @@ -584,7 +584,7 @@ struct Variant_get } \ \ template \ - constexpr auto variant_dispatch( \ + constexpr auto variant_dispatch_index( \ Fn &&fn, Const Variant_values Ref values, std::size_t index, Args &&... args) \ ->decltype( \ variant_dispatch_helper(std::forward(fn), \ @@ -628,7 +628,7 @@ struct Variant_get } \ \ template \ - constexpr auto variant_dispatch_nothrow( \ + constexpr auto variant_dispatch_index_nothrow( \ Fn &&fn, Const Variant_values Ref values, std::size_t index, Args &&... args) \ ->decltype(variant_dispatch_helper_nothrow( \ std::forward(fn), \ @@ -1300,7 +1300,7 @@ template typename std::common_type()(std::declval()))...>::type variant_dispatch(Fn &&fn, variant &v, Args &&... args) { - return variant_dispatch( + return variant_dispatch_index( std::forward(fn), v.values, v.index_value.get(), std::forward(args)...); } @@ -1308,7 +1308,7 @@ template typename std::common_type()(std::declval()))...>::type variant_dispatch(Fn &&fn, const variant &v, Args &&... args) { - return variant_dispatch( + return variant_dispatch_index( std::forward(fn), v.values, v.index_value.get(), std::forward(args)...); } @@ -1316,45 +1316,45 @@ template typename std::common_type()(std::declval()))...>::type variant_dispatch(Fn &&fn, variant &&v, Args &&... args) { - return variant_dispatch(std::forward(fn), - std::move(v.values), - v.index_value.get(), - std::forward(args)...); + return variant_dispatch_index(std::forward(fn), + std::move(v.values), + v.index_value.get(), + std::forward(args)...); } template typename std::common_type()(std::declval()))...>::type variant_dispatch(Fn &&fn, const variant &&v, Args &&... args) { - return variant_dispatch(std::forward(fn), - std::move(v.values), - v.index_value.get(), - std::forward(args)...); + return variant_dispatch_index(std::forward(fn), + std::move(v.values), + v.index_value.get(), + std::forward(args)...); } template -decltype(variant_dispatch(std::declval(), std::declval &>())) variant_visit( - Fn &&fn, variant &v) +typename std::common_type()(std::declval()))...>::type + variant_visit(Fn &&fn, variant &v) { return variant_dispatch(std::forward(fn), v); } template -decltype(variant_dispatch(std::declval(), std::declval &>())) +typename std::common_type()(std::declval()))...>::type variant_visit(Fn &&fn, const variant &v) { return variant_dispatch(std::forward(fn), v); } template -decltype(variant_dispatch(std::declval(), std::declval &&>())) variant_visit( - Fn &&fn, variant &&v) +typename std::common_type()(std::declval()))...>::type + variant_visit(Fn &&fn, variant &&v) { return variant_dispatch(std::forward(fn), std::move(v)); } template -decltype(variant_dispatch(std::declval(), std::declval &&>())) +typename std::common_type()(std::declval()))...>::type variant_visit(Fn &&fn, const variant &&v) { return variant_dispatch(std::forward(fn), std::move(v));