On 4/6/19 10:51 AM, Peter Dimov via Boost wrote:
Larry Evans wrote:
I only drew that conclusion because the number of args seems the only difference between the test that compiles OK and the one that doesn't. The code was copy&pasted from:
https://github.com/pdimov/variant2/blob/develop/test/variant_visit.cpp#L105
and the function object there only accepts `int` as it's first argument. So, does that compile because any of the alternative types can be converted to `int`?
Yes.
Hmmm. Changed the all types of the lamba args to auto and it still fails to compile :( Why is that?
If we're talking about this program:
#include
#include <string> using namespace boost::variant2;
int main() { variant
v1( 1 ); variant const v2( 3.14f ); variant v3( 6.28 ); variant const v4( 'A' ); variant const v5( "xxx" ); visit( []( auto x1, auto x2, auto x3, auto x4, auto x5 ){}, v1, v2, v3, v4, v5 ); }
it compiles with g++/clang++ -std=c++14, and doesn't with -std=c++11. It also doesn't compile on VS2017 but compiles on VS2019. That's because the unlimited argument implementation is disabled on C++11 or VS2017 here:
https://github.com/pdimov/variant2/blob/develop/include/boost/variant2/varia...
and, you're right, the workaround only supports up to four arguments.
Thanks for clearing that up. However, I did some more exploring, and with the attached: when only defined(UNSIGNED_I4), it compiles within a few secs. when only defined(UNSIGNED_I5), it times several seconds consuming 100% of one of my cpu's, but eventually compiles. OTOH, when onely UNSIGNED_I5) is defined, it never terminates: --{--cut here-- -*- mode: compilation; default-directory: "~/prog_dev/boost/releases/ro/boost_1_69_0/sandbox/pdimov/variant2/review/" -*- Compilation started at Sat Apr 6 12:13:45 make -k run /usr/bin/clang++ -c -O0 -gdwarf-2 -std=c++17 -ftemplate-backtrace-limit=0 -fdiagnostics-show-template-tree -fno-elide-type -fmacro-backtrace-limit=0 -I../variant2/include -I/home/evansl/prog_dev/boost/releases/ro/boost_1_69_0 -ftemplate-depth=200 visit_unsigned_i.cpp -MMD -o /tmp/build/clangxx6_0_pkg/boost/releases/ro/boost_1_69_0/sandbox/pdimov/variant2/review/visit_unsigned_i.o /home/evansl/prog_dev/root.imk:182: recipe for target '/tmp/build/clangxx6_0_pkg/boost/releases/ro/boost_1_69_0/sandbox/pdimov/variant2/review/visit_unsigned_i.o' failed make: *** [/tmp/build/clangxx6_0_pkg/boost/releases/ro/boost_1_69_0/sandbox/pdimov/variant2/review/visit_unsigned_i.o] Interrupt Compilation interrupt at Sat Apr 6 12:14:33 --}--cut here-- Have you any idea why? -regards, Larry