view gcc/testsuite/g++.old-deja/g++.robertl/eb59.C @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children
line wrap: on
line source

// { dg-do run  }
#define INC_FUNCTIONAL  1
#define USE_STATIC_CAST 1

#include <vector>
#include <numeric>
#ifdef INC_FUNCTIONAL
#include <functional>
#endif

using namespace std;

template<class R> int p( int val, R& r )
{
   return val + r;
}

template<class R> void f( vector<R>& v )
{
#ifdef USE_STATIC_CAST
   accumulate( v.begin(), v.end(), 0, static_cast<int (*)(int, R&)>(p) );
#else
   accumulate( v.begin(), v.end(), 0, p<R> );
#endif
}

int main()
{
   vector<int> r;
   f( r );
}