title: Function template bizzare problem
body: <pre><code>    // UsingDirective.cpp : Defines the entry point for the console application.
      //
  
      #include "stdafx.h"
      #include &lt;iostream&gt;
      using namespace std;
  
      #pragma once
  
      #include &lt;type_traits&gt;
  
      #pragma region CheckForFailureSignalPolicy
       template&lt;class Exception&gt;
       struct ThrowOnFailure;
  
       template&lt;class Exception&gt;
       struct NullOnFailure;
  
       template&lt;template&lt;class&gt;class FailureSignalPolicy&gt;
       struct IsThrowOnFailure;
  
  
  
  
  
       template&lt;&gt;
       struct IsThrowOnFailure&lt;ThrowOnFailure&gt;
       {
        enum {value = 1};
       };
  
       template&lt;&gt;
       struct IsThrowOnFailure&lt;NullOnFailure&gt;
       {
        enum {value = 0};
       };
  
  
  
      #pragma endregion
  
        template&lt;int v&gt;
       struct Int2Type
       {};
  
       template&lt;template&lt;class&gt; class FailurePolicy,class ExceptionType &gt;
       struct IReportFailure
       {
        enum {isThrowing = IsThrowOnFailure&lt;FailurePolicy&gt;::value};
      #pragma region empty
        static auto reportFailure()-&gt; typename std::conditional&lt;isThrowing,void,std::nullptr_t&gt;::type
        {
         return rprt_help(Int2Type&lt;isThrowing&gt;());
        }
  
        static void rprt_help(Int2Type&lt;true&gt;)
        {
         throw ExceptionType();
        }
  
        static std::nullptr_t rprt_help(Int2Type&lt;false&gt;)
        {
         return nullptr;
        }
      #pragma endregion
  //******************************************
        template&lt;class Argument&gt;
        static auto reportFailure(const Argument&amp; arg)-&gt; typename std::conditional&lt;isThrowing,void,std::nullptr_t&gt;::type
        {
         return rprt_help(const Argument&amp; arg,Int2Type&lt;isThrowing&gt;());
        }
  
        template&lt;class Argument&gt;
        static void rprt_help(const Argument&amp; arg,Int2Type&lt;true&gt;)
        {
         throw ExceptionType(arg);
        }
        template&lt;class Argument&gt;
        static std::nullptr_t rprt_help(const Argument&amp; arg,Int2Type&lt;false&gt;)
        {
         return nullptr;
        }
      #pragma region ExceptionType
        static auto reportFailure(const ExceptionType&amp; ex)-&gt; typename std::conditional&lt;isThrowing,void,std::nullptr_t&gt;::type
        {
         return rprt_help(const ExceptionType&amp; ex,Int2Type&lt;isThrowing&gt;());
        }
  
        static void rprt_help(const ExceptionType&amp; ex,Int2Type&lt;true&gt;)
        {
         throw ExceptionType(ex);
        }
  
        static std::nullptr_t rprt_help(const ExceptionType&amp; ex,Int2Type&lt;false&gt;)
        {
         return nullptr;
        }
      #pragma endregion
  
  
  
  
       };
  
       template&lt;template&lt;class&gt; class FailurePolicy, class ExceptionType&gt;
       struct FailureSignalPolicy
       {
        enum {isThrowing = IsThrowOnFailure&lt;FailurePolicy&gt;::value};
  
  
        static auto
         signalFailure() -&gt; typename std::conditional&lt;IsThrowOnFailure&lt;FailurePolicy&gt;::value,void,std::nullptr_t&gt;::type
  
        {
         return IReportFailure&lt;FailurePolicy,ExceptionType&gt;::reportFailure();
        }
  
        static auto
         signalFailure(const ExceptionType&amp; ex) -&gt; typename std::conditional&lt;IsThrowOnFailure&lt;FailurePolicy&gt;::value,void,std::nullptr_t&gt;::type
  
        {
         return IReportFailure&lt;FailurePolicy,ExceptionType&gt;::reportFailure(ex);
        }
  ///*******************************************
        template&lt;class Argument&gt;
        static auto
         signalFailure(const Argument&amp; arg) -&gt; typename std::conditional&lt;IsThrowOnFailure&lt;FailurePolicy&gt;::value,void,std::nullptr_t&gt;::type
  
        {
         return IReportFailure&lt;FailurePolicy,ExceptionType&gt;::reportFailure(arg);
        }
       };
  
       template&lt;class ExceptionType&gt;
       struct ThrowOnFailure : private FailureSignalPolicy&lt;ThrowOnFailure,ExceptionType&gt;
       {
        using FailureSignalPolicy&lt; ::ThrowOnFailure,ExceptionType&gt;::signalFailure; 
       };
  
       template&lt;class ExceptionType&gt;
       struct NullOnFailure : private FailureSignalPolicy&lt;NullOnFailure,ExceptionType&gt;
       {
        using FailureSignalPolicy&lt; ::NullOnFailure,ExceptionType&gt;::signalFailure;
       };
  
  
      int _tmain(int argc, _TCHAR* argv[])
      {
       try
       {
       /*ThrowOnFailure&lt;int&gt;::signalFailure();
       NullOnFailure&lt;int&gt;::signalFailure();*/
       ThrowOnFailure&lt;std::out_of_range&gt;::signalFailure(1);
       }
       catch(...)
       {
       }
       return 0;
      }
  </code></pre>
  
  <p>Trying to compile this I'm getting bizzare errors:<br>
  Error 1 error C2143: syntax error : missing ')' before 'const'<br>
  Error 2 error C2661: 'IReportFailure::rprt_help' : no overloaded function takes 0 arguments<br>
  Error 3 error C2059: syntax error : ')' </p>
  
  <p>The problematic fnc is marked in code with <strong><em>*</em>**<em>*</em></strong></p>