diff options
author | Stephen Kelly <steveire@gmail.com> | 2015-01-16 18:21:36 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2015-01-17 13:48:27 (GMT) |
commit | 536c535cb0cf245a1785d436b0662f7fe59ef1e4 (patch) | |
tree | 5e3ca591180a5947f846d216d0134f2c0cb629af /Tests/CompileFeatures | |
parent | 5d57970dd9ddea70163bdd3c64fbf365a15af9fb (diff) | |
download | CMake-536c535cb0cf245a1785d436b0662f7fe59ef1e4.zip CMake-536c535cb0cf245a1785d436b0662f7fe59ef1e4.tar.gz CMake-536c535cb0cf245a1785d436b0662f7fe59ef1e4.tar.bz2 |
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.
Diffstat (limited to 'Tests/CompileFeatures')
-rw-r--r-- | Tests/CompileFeatures/cxx_variadic_templates.cpp | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/Tests/CompileFeatures/cxx_variadic_templates.cpp b/Tests/CompileFeatures/cxx_variadic_templates.cpp index a80e157..e1f641b 100644 --- a/Tests/CompileFeatures/cxx_variadic_templates.cpp +++ b/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; } }; |