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.
This commit is contained in:
Stephen Kelly 2015-01-16 19:21:36 +01:00
parent 5d57970dd9
commit 536c535cb0
1 changed files with 18 additions and 9 deletions

View File

@ -1,5 +1,23 @@
#if defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) < 407)
#define OLD_GNU
#endif
#ifdef OLD_GNU
template<int... Is>
struct Interface;
#endif
template<int I, int... Is>
struct Interface
#ifdef OLD_GNU
<I, Is...>
#endif
{
static int accumulate()
{
return I + Interface<Is...>::accumulate();
}
};
template<int I>
struct Interface<I>
@ -10,15 +28,6 @@ struct Interface<I>
}
};
template<int I, int... Is>
struct Interface<I, Is...>
{
static int accumulate()
{
return I + Interface<Is...>::accumulate();
}
};
// Note: split this into a separate test if a
// cxx_variadic_template_template_parameters feature is added.