From 98b5d42e6d8fc188c40a56aa3a558bed595ee643 Mon Sep 17 00:00:00 2001 From: Antony Polukhin Date: Wed, 21 Feb 2018 23:10:25 +0300 Subject: [PATCH] Do substitute function arguments on compilers with variadic templates support (more fixes for the #42) --- include/boost/variant/detail/substitute.hpp | 4 +++- test/issue42.cpp | 15 ++++++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/include/boost/variant/detail/substitute.hpp b/include/boost/variant/detail/substitute.hpp index 08972d6..f9d29a5 100644 --- a/include/boost/variant/detail/substitute.hpp +++ b/include/boost/variant/detail/substitute.hpp @@ -166,7 +166,9 @@ private: typedef typename substitute< R, Dest, Source >::type r; public: - typedef r (*type)(A...); + typedef r (*type)(typename substitute< + A, Dest, Source + >::type...); }; #else diff --git a/test/issue42.cpp b/test/issue42.cpp index a8ce7ab..a7d8842 100644 --- a/test/issue42.cpp +++ b/test/issue42.cpp @@ -25,7 +25,8 @@ typedef std::shared_ptr ptr_t; #endif - +template +class func{}; int main() { typedef boost::make_recursive_variant< @@ -36,6 +37,7 @@ int main() { node x = 1; (void)x; + typedef boost::make_recursive_variant< std::string, int, double, bool, ptr_t, @@ -45,4 +47,15 @@ int main() { node2 x2 = 1; (void)x2; + + + typedef boost::make_recursive_variant< + int, + func, + boost::recursive_variant_&(*)(boost::recursive_variant_, boost::recursive_variant_*), + ptr_t + >::type node3; + + node3 x3 = func(); + (void)x3; }