Pārlūkot izejas kodu

Features: Adjust cxx_variadic_templates unit test for SolarisStudio.

The change in commit 1f19ac4d (Features: Adjust cxx_variadic_templates
unit test for GNU < 4.7., 2015-01-11) pacified GNU 4.6, but leaves
SolarisStudio 12.4 complaining:

 "cxx_variadic_templates.cpp", line 5: Error: Partial specialization for Interface<Is...> has identical arguments.
 1 Error(s) detected.

Implement a preprocessor test for using the partial specialization
workaround needed by GNU 4.6.
Stephen Kelly 10 gadi atpakaļ
vecāks
revīzija
536c535cb0
1 mainītis faili ar 15 papildinājumiem un 6 dzēšanām
  1. 15 6
      Tests/CompileFeatures/cxx_variadic_templates.cpp

+ 15 - 6
Tests/CompileFeatures/cxx_variadic_templates.cpp

@@ -1,21 +1,30 @@
+#if defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) < 407)
+#define OLD_GNU
+#endif
+
+#ifdef OLD_GNU
 template<int... Is>
 struct Interface;
+#endif
 
-template<int I>
-struct Interface<I>
+template<int I, int... Is>
+struct Interface
+#ifdef OLD_GNU
+                <I, Is...>
+#endif
 {
   static int accumulate()
   {
-    return I;
+    return I + Interface<Is...>::accumulate();
   }
 };
 
-template<int I, int... Is>
-struct Interface<I, Is...>
+template<int I>
+struct Interface<I>
 {
   static int accumulate()
   {
-    return I + Interface<Is...>::accumulate();
+    return I;
   }
 };