title: C++ Windows notification: Use of dependent template name
body: <p>I'm currently trying to create a callback for Windows 10 native notification. My code for adding notification looks following:</p>
  
  <pre><code>notification-&gt;add_Dismissed(
      Callback&lt;Implements&lt;RuntimeClassFlags&lt;ClassicCom&gt;,
      ITypedEventHandler&lt;ToastNotification*, ToastDismissedEventArgs*&gt;&gt;&gt;(
  
      [eventHandler, expirationTime](IToastNotification*, IToastDismissedEventArgs* e) {
  
          ToastDismissalReason reason;
          if (SUCCEEDED(e-&gt;get_Reason(&amp;reason))) {
              if (reason == ToastDismissalReason_UserCanceled &amp;&amp;
                  expirationTime &amp;&amp;
                  MyDateTime::Now() &gt;= expirationTime
              ){
                  reason = ToastDismissalReason_TimedOut;
              }
  
              eventHandler-&gt;toastDismissed(static_cast&lt;IWinToastHandler::WinToastDismissalReason&gt;(reason));
          }
  
          return S_OK;
  }).Get(), &amp;dismissedToken);
  </code></pre>
  
  <p>Where <code>notification</code> is <code>IToastNotification*</code> and <code>eventHandler</code> is my custom handler class.</p>
  
  <p>However since last Visual Studio update, I'm getting following errors:</p>
  
  <pre><code>c:\program files (x86)\windows kits\10\include\10.0.17134.0\winrt\wrl\event.h(316): error C7510: 'Callback': use of dependent template name must be prefixed with 'template'
  c:\program files (x86)\windows kits\10\include\10.0.17134.0\winrt\wrl\event.h(324): error C7510: 'Callback': use of dependent template name must be prefixed with 'template'
  </code></pre>
  
  <p>Follows code which is referenced by the error messages:</p>
  
  <pre><code>// Construct a COM/WinRT delegate (an object with an Invoke() method) from a lambda.
  // Check the return from this function for null to detect out of memory (E_OUTOFMEMORY) failure case.
  template&lt;typename TDelegateInterface, typename TLambda&gt;
  ComPtr&lt;typename Details::DelegateArgTraitsHelper&lt;TDelegateInterface&gt;::Interface&gt; Callback(TLambda&amp;&amp; callback) throw()
  {
      using DelegateHelper = Details::DelegateArgTraitsHelper&lt;TDelegateInterface&gt;;
      return DelegateHelper::Traits::Callback&lt;TDelegateInterface, typename DelegateHelper::Interface&gt;(Details::Forward&lt;TLambda&gt;(callback));
  }
  
  // Construct a COM/WinRT delegate, an object with an Invoke() method, from a raw function.
  template&lt;typename TDelegateInterface, typename TFunc&gt; ComPtr&lt;typename Details::DelegateArgTraitsHelper&lt;TDelegateInterface&gt;::Interface&gt; Callback(_In_ TFunc* callback) throw()
  {
      using DelegateHelper = Details::DelegateArgTraitsHelper&lt;TDelegateInterface&gt;;
      return DelegateHelper::Traits::Callback&lt;TDelegateInterface, typename DelegateHelper::Interface&gt;(
      [=](auto&amp;&amp; ...args) {
          return callback(Details::Forward&lt;decltype(args)&gt;(args)...);
      });
  }
  </code></pre>
  
  <p>Honestly, I've got any idea, what's wrong. Since last update, this particular code was working (as far as I know). Would you please point me to the solution?</p>
  
  <p>I understand that it has something to do with dependent template names. But I don't know what part of code is wrong - if it's some kind of typo in <code>winrt</code> or they changed something lately and I have to adjust my code.</p>
  
  <p>Thank you for suggestions.</p>