Patchwork [C++,testcase] PR 53307

login
register
mail settings
Submitter Paolo Carlini
Date Oct. 9, 2012, 11:39 p.m.
Message ID <5074B598.3090801@oracle.com>
Download mbox | patch
Permalink /patch/190513/
State New
Headers show

Comments

Paolo Carlini - Oct. 9, 2012, 11:39 p.m.
Hi,

I'm adding the testcase and closing the PR as fixed. Tested x86_64-linux.

Thanks,
Paolo.

//////////////////////
2012-10-10  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/53307
	* g++.dg/cpp0x/decltype44.C: New.

Patch

Index: g++.dg/cpp0x/decltype44.C
===================================================================
--- g++.dg/cpp0x/decltype44.C	(revision 0)
+++ g++.dg/cpp0x/decltype44.C	(working copy)
@@ -0,0 +1,44 @@ 
+// PR c++/53307
+// { dg-do compile { target c++11 } }
+
+template <class...Ts> struct tuple{};
+
+struct funct
+{
+  template <class T, class...argTs>
+  T operator()(T arg1, argTs...)
+  {
+    return arg1;
+  }
+};
+
+template <class...>class test;
+
+template < template <class...> class tp,
+	   class...arg1Ts,
+	   class...arg2Ts> 
+class test<tp<arg1Ts...>, tp<arg2Ts...>>
+{
+ public:
+  template <class func>
+    auto test_pass(func fun, arg2Ts...arg2s) 
+    -> decltype(fun(arg2s...)) 
+  {
+    return fun(arg2s...);
+  }
+
+  template <class func, class...arg3Ts>
+    auto testbug(func fun, arg2Ts...arg2s, arg3Ts...arg3s)
+    -> decltype(fun(arg2s..., arg3s...)) 
+  {
+    return fun(arg2s..., arg3s...);
+  }
+};
+
+int main()
+{	
+  test<tuple<>, tuple<char, int>> t;
+  t.test_pass (funct(), 'a', 2);
+  t.testbug (funct(), 'a', 2, "fine");
+  t.testbug (funct(), 'a', 2);
+}