title: How to add noexcept specifier to already defined function type?
body: <p>For example I have type:</p>
  <pre><code>typedef DWORD WINAPI HANDLER_FUNCTION_EX (DWORD);
  </code></pre>
  <p>And I want:</p>
  <pre><code>static as_noexcept&lt;HANDLER_FUNCTION_EX&gt;::type my_func; // forward declaration
  static_assert(noexcept(my_func(0)));
  </code></pre>
  <p>I got something like:</p>
  <pre><code>template&lt;typename&gt;
  struct noexcept_trait;
  
  // specialization to infer signature
  template&lt;typename Result, typename... Args&gt;
  struct noexcept_trait&lt;Result(Args...)&gt;
  {
      using as_noexcept = Result(Args...) noexcept;
      using as_throwing = Result(Args...);
  };
  // since C++17 noexcept-specification is a part of the function type
  // so first specialization won't match
  template&lt;typename Result, typename... Args&gt;
  struct noexcept_trait&lt;Result(Args...) noexcept&gt;
  {
      using as_noexcept = Result(Args...) noexcept;
      using as_throwing = Result(Args...);
  };
  
  template&lt;typename T&gt;
  using add_noexcept_t = typename noexcept_trait&lt;T&gt;::as_noexcept;
  template&lt;typename T&gt;
  using remove_noexcept_t = typename noexcept_trait&lt;T&gt;::as_throwing;
  </code></pre>
  <p>But this code creates totally new type and drops all additional info (calling convention, attributes e.g. <code>[[deprecated]]</code>). So it's not safe. How can I fix it?</p>