]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
recog: Restore builds with Clang
authorRichard Sandiford <richard.sandiford@arm.com>
Mon, 22 Jun 2020 19:15:36 +0000 (20:15 +0100)
committerRichard Sandiford <richard.sandiford@arm.com>
Mon, 22 Jun 2020 19:15:36 +0000 (20:15 +0100)
Using parameter packs with function typedefs tripped a Clang bug
in which the packs were not being expanded correctly:

  https://bugs.llvm.org/show_bug.cgi?id=46377

Work around that by going back to the decltype approach, but adding
a cast to void to suppress a warning about unused values.

2020-06-22  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
* coretypes.h (first_type): Delete.
* recog.h (insn_gen_fn::operator()): Go back to using a decltype.

gcc/coretypes.h
gcc/recog.h

index 720f9f9c63f38b0f2c210f41bc3dd0a378afca1c..6b6cfcdf210d94e8d08bb0f117eb54392fc11073 100644 (file)
@@ -359,10 +359,6 @@ struct kv_pair
   const ValueType value;       /* the value of the name */
 };
 
-/* Alias of the first type, ignoring the second.  */
-template<typename T1, typename T2>
-using first_type = T1;
-
 /* Iterator pair used for a collection iteration with range-based loops.  */
 
 template<typename T>
index d674d384723a8933a9e317d938df6b645cd6c7be..3e4b55bdf3f00618e846431b926ce49082a18b8c 100644 (file)
@@ -297,7 +297,7 @@ struct insn_gen_fn
   template<typename ...Ts>
   rtx_insn *operator() (Ts... args) const
   {
-    typedef rtx_insn *(*funcptr) (first_type<rtx, Ts>...);
+    typedef rtx_insn *(*funcptr) (decltype ((void) args, NULL_RTX)...);
     return ((funcptr) func) (args...);
   }