//OriginalSource:
//  https://github.com/pdimov/variant2/blob/develop/test/variant_visit.cpp
//Purpose:
//  See if 5 argument visitor will work.
//ChangeLog
//  rm'ed all tests except the one with 4 args
//  ; then added another arg (to make it 5 args).
//Result:
//  when #defined(ARGS5), get compile error:
/*
In file included from visit5.cpp:16:
../variant2/include/boost/variant2/variant.hpp:1700:47: error: no matching function for call to object of type
      '(lambda at visit5.cpp:47:16)'
    template<class... T> using fn = decltype( std::declval<F>()( std::declval<T>()... ) );
 */
//======================
// Copyright 2017 Peter Dimov.
//
// Distributed under the Boost Software License, Version 1.0.
//
// See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt

#include <boost/variant2/variant.hpp>
#include <boost/mp11.hpp>
#include <boost/core/lightweight_test.hpp>
#include <boost/core/lightweight_test_trait.hpp>
#include <boost/config.hpp>
#include <type_traits>
#include <utility>
#include <string>
#include <cstdio>

using namespace boost::variant2;

int main()
{
    {
        variant<int, float, double, char> v1( 1 );
        variant<int, float, double, char> const v2( 3.14f );
        variant<int, float, double, char> v3( 6.28 );
        variant<int, float, double, char> const v4( 'A' );

        visit( []( int x1, float x2, double x3, char x4 ){ BOOST_TEST_EQ( x1, 1 ); BOOST_TEST_EQ( x2, 3.14f ); BOOST_TEST_EQ( x3, 6.28 ); BOOST_TEST_EQ( x4, 'A' ); }, v1, v2, v3, v4 );
    }
  #define ARGS5
  #ifdef ARGS5
    {
        variant<int, float, double, char, std::string> v1( 1 );
        variant<int, float, double, char, std::string> const v2( 3.14f );
        variant<int, float, double, char, std::string> v3( 6.28 );
        variant<int, float, double, char, std::string> const v4( 'A' );
        variant<int, float, double, char, std::string> const v5( "xxx" );

        visit( []( int x1, float x2, double x3, char x4, std::string x5 ){ BOOST_TEST_EQ( x1, 1 ); BOOST_TEST_EQ( x2, 3.14f ); BOOST_TEST_EQ( x3, 6.28 ); BOOST_TEST_EQ( x4, 'A' ); BOOST_TEST_EQ( x4, "xxx" );}, v1, v2, v3, v4, v5 );
    }
  #endif
    return boost::report_errors();
}
