+  template<typename ...Ts>
+  rtx_insn *operator() (Ts... args...) const

Why is this declared as a variadic template **and** a varargs function?

I think the second ellipsis is wrong, it should be just:

+  template<typename ...Ts>
+  rtx_insn *operator() (Ts... args) const


And this seems like a more direct way to say "a list of N rtx types"
where N is sizeof...(args):

diff --git a/gcc/recog.h b/gcc/recog.h
index 0a71a02c4a9..fd22c58c92a 100644
--- a/gcc/recog.h
+++ b/gcc/recog.h
@@ -294,10 +294,13 @@ struct insn_gen_fn
 {
   typedef void (*stored_funcptr) (void);
 
+  template<typename T> using rtx_t = rtx;
+
   template<typename ...Ts>
-  rtx_insn *operator() (Ts... args...) const
+  rtx_insn *operator() (Ts... args) const
   {
-    return ((rtx_insn *(*) (decltype(args, NULL_RTX)...)) func) (args...);
+    using funcptr = rtx_insn * (*) (rtx_t<Ts>...);
+    return ((funcptr) func) (args...);
   }
 
   // This is for compatibility of code that invokes functions like

The rtx_t<T> alias is the type 'rtx' for any T. The pack expansion
rtx_t<Ts>... is a list of rtx the same length as the pack Ts.

The 'funcptr' alias sin't necessary, but (IMHO) simplifies the
following line, by splitting the definition of the complicated
function pointer type from its use.



Reply via email to