<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/131700>131700</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Overly pedantic [[noreturn]] restriction
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
kimbarrett
</td>
</tr>
</table>
<pre>
C++11 says that the first declaration of a function must specify the `[[noreturn]]` attribute if any declaration specifies it.
All of gcc, clang, and MSVC provide compiler-specific mechanisms to indicate a function is "noreturn". gcc and clang have `attribute((noreturn))`, while MSVC has `__declspec(noreturn)`. gcc and MSVC treat their compiler-specific attributes as satisfying the first declaration attribute requirement, but clang does not. That is, this compiles cleanly with gcc, but clang issues a warning
```
attribute((noreturn)) void testfn(int);
[[noreturn]] void testfn(int);
```
and this compiles cleanly with MSVC, but clang issues a warning
```
__declspec(noreturn) void testfn(int);
[[noreturn]] void testfn(int);
```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJy0VE1vm0wQ_jXLZRRrWfDXgYOdyLdX76FVr9GyDDDtsrg7gy3_-2qxE6dVEqmHSiPZCOb5hLXM1AXESi33avmU2Un6MVY_aKhtjCiS1WNzqR6V2Suzz3Nge2GQ3gpIj9BSZIEGnbfRCo0BxhYstFNw89UwsQAf0VF7mRfUSs9M-zBGlCkGtXxKs9JgRSLVkyBQCzZcfoO9YhAykCyU3im923mf2DrnlHkE523o0h8bGvjvy7dHOMbxRA2CG4cjeYwPNwwHA7reBuKBQUag0JCzgm91E4My5lWjMQtIRDP4zAS9Pc1uXlUrs1Fmc1_ZplnpJOnck8erqN5y2np-TuaSoD92VvoN07whEa9hU3zHyis9g2VgK8TthUL3QTv3jCP-nCjigEGSxHqSm7FmRIYwygLga6qZON2XnviFnsF5tMFf4EzSvxRwRyDmKemBs42BQpfqWunb6N2nicFppAYEWdqgzIaSuq0q9gnjnffms8ffUobmMwcp57-y8FF9_0B91lRFsy22NsMqX5fGLDe6LLK-crlrdV06o129yvO1Wa5bU2DeoGlq1Dajymiz1EW-0boodbGwTi-3ZVPXddmu17lWpcbBkl94fxoWY-yy2XaVF_la68zbGj3PB4MxAc_XUJQx6ZyIVVp6qKeOVak9sfAdRkg8Vv-fMPoLHLGxQcjBuwlEZIk0f3TZFH3VixxZFTtlDsocOpJ-qhduHJQ5JPjbz8Mxjt_RiTKHa1PKHG6qT5X5FQAA__-EX5Ra">