aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/g++.old-deja/g++.robertl/eb59.C
blob: 84ccff26d16314b4160f1ab7454c1fe943d0c329 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// { 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 );
}