summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.robertl/eb59.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.old-deja/g++.robertl/eb59.C')
-rw-r--r--gcc/testsuite/g++.old-deja/g++.robertl/eb59.C31
1 files changed, 31 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb59.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb59.C
new file mode 100644
index 000000000..84ccff26d
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb59.C
@@ -0,0 +1,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 );
+}