[flang] Cleaned folding test helper template
authorJean Perier <jperier@hsw1.pgi.net>
Fri, 25 Jan 2019 11:24:31 +0000 (03:24 -0800)
committerJean Perier <jperier@hsw1.pgi.net>
Fri, 25 Jan 2019 11:24:31 +0000 (03:24 -0800)
Original-commit: flang-compiler/f18@b402c0a09caf079d2a0a44ac339894412c491e74

flang/test/evaluate/folding.cc

index 4ec630a..7c15d53 100644 (file)
 
 using namespace Fortran::evaluate;
 
-// helpers to call functions on all types from tuple
-template<typename... T> static void VariadicCallHelper(const T... args) {
-  return;
-}
-
+// helper to call functions on all types from tuple
+template<typename... T> struct RunOnTypes {};
 template<typename Test, typename... T>
-static void VariadicCallHelper(const std::tuple<T...> dummy) {
-  VariadicCallHelper(Test::template Run<T>()...);
-  return;
-}
+struct RunOnTypes<Test, std::tuple<T...>> {
+  static void Run() { (..., Test::template Run<T>()); }
+};
 
 struct TestGetScalarConstantValue {
-  template<typename T> static bool Run() {
+  template<typename T> static void Run() {
     Expr<T> exprFullyTyped{Constant<T>{Scalar<T>{}}};
     Expr<SomeKind<T::category>> exprSomeKind{exprFullyTyped};
     Expr<SomeType> exprSomeType{exprSomeKind};
     TEST(GetScalarConstantValue<T>(exprFullyTyped) != nullptr);
     TEST(GetScalarConstantValue<T>(exprSomeKind) != nullptr);
     TEST(GetScalarConstantValue<T>(exprSomeType) != nullptr);
-    return true;
   }
 };
 
 int main() {
-  VariadicCallHelper<TestGetScalarConstantValue>(AllIntrinsicTypes{});
+  using TestTypes = AllIntrinsicTypes;
+  RunOnTypes<TestGetScalarConstantValue, TestTypes>::Run();
   return testing::Complete();
 }