From 14bfe622f86213d20c93a61a5fc53539046824e2 Mon Sep 17 00:00:00 2001 From: Jason Rhinelander Date: Fri, 25 Nov 2016 13:23:01 -0500 Subject: [PATCH] Simplify cast_op return type (#532) Using a complicated declval here was pointlessly complicated: we already know the type, because that's what cast_op_type is in the first place. (The declval also broke MSVC). --- include/pybind11/cast.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/include/pybind11/cast.h b/include/pybind11/cast.h index b1dc3f4af..3486af3ba 100644 --- a/include/pybind11/cast.h +++ b/include/pybind11/cast.h @@ -433,12 +433,10 @@ template class type_caster : public type template using make_caster = type_caster>; // Shortcut for calling a caster's `cast_op_type` cast operator for casting a type_caster to a T -template -auto cast_op(make_caster &caster) -> decltype(caster.operator typename make_caster::template cast_op_type()) { +template typename make_caster::template cast_op_type cast_op(make_caster &caster) { return caster.operator typename make_caster::template cast_op_type(); } -template -auto cast_op(make_caster &&caster) -> decltype(caster.operator typename make_caster::template cast_op_type()) { +template typename make_caster::template cast_op_type cast_op(make_caster &&caster) { return cast_op(caster); }