<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
        "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<title>Putting noexcept(auto) on hold, again</title>

	<style>
	p {text-align:justify}
	li {text-align:justify}
	blockquote.note
	{
		background-color:#E0E0E0;
		padding-left: 15px;
		padding-right: 15px;
		padding-top: 1px;
		padding-bottom: 1px;
	}
	ins {color:#00A000}
	del {color:#A00000}
	</style>
</head>
<body>

<address align=right>
Document number: P0133R0
<br/>
<br/>
<a href="mailto:ville.voutilainen@gmail.com">Ville Voutilainen</a><br/>
2015-09-27<br/>
</address>
<hr/>
<h1 align=center>Putting noexcept(auto) on hold, again</h1>

<h2>Abstract</h2>
<p>
EWG liked the idea of having noexcept(auto) in Lenexa. Bjarne voiced
concern about making brittle interfaces easier to author. Agustin
Berge pointed out that the apparent savings in explicit specification
don't work when SFINAE on return type is desirable.
</p>

<h2>Rumination</h2>
<p>
  Let's repeat the usual example of where a noexcept-specification
  repeats the expression in the function body:
</p>
<pre>
  <code>
    template &lt;class T, class U&gt;
    auto myplus(T&amp;&amp; t, U&amp;&amp; t) noexcept(noexcept(declval&lt;T&gt;()+declval&lt;U&gt;())) -> decltype(t+u)
    {
        return t+u;
    }
  </code>
</pre>
<p>
  The main argument for noexcept(auto) is avoiding repetitions of the expression
  in the body, and an additional argument is that since return type deduction
  allows avoiding repeating the expression in a trailing return type, it would
  be nice to avoid repeating it in the noexcept-specifier.
</p>
<p>
  The problem is that return type deduction will not help us. The practical
  examples of code like that in transparent operator-like functors and swap
  functions
  want to SFINAE on the return type, so we can't get rid of that repetition.
</p>
<p>
  To summarize, noexcept(auto) would probably go some ways towards making
  transparent operator-like functors and swap functions prettier, but
  that serves an allegedly small crowd of programmers, while making writing
  brittle interfaces much easier for non-experts. Overall, that doesn't
  seem like the best of motivations for a language extension. I am therefore
  not going to propose going further with noexcept(auto) at this point.
</p>
</body>

</html>
