<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Hi,</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
We have the below code where this warning gets generated. </div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<p class="MsoNormal" style="margin:0in;font-size:11pt;font-family:Calibri, sans-serif">
#include <iostream><o:p> </o:p></p>
<p class="MsoNormal" style="margin:0in;font-size:11pt;font-family:Calibri, sans-serif">
<o:p> </o:p></p>
<p class="MsoNormal" style="margin:0in;font-size:11pt;font-family:Calibri, sans-serif">
[[noreturn]] inline void<o:p> </o:p></p>
<p class="MsoNormal" style="margin:0in;font-size:11pt;font-family:Calibri, sans-serif">
abc () noexcept<o:p> </o:p></p>
<p class="MsoNormal" style="margin:0in;font-size:11pt;font-family:Calibri, sans-serif">
{<o:p> </o:p></p>
<p class="MsoNormal" style="margin:0in;font-size:11pt;font-family:Calibri, sans-serif">
std::terminate ();<o:p> </o:p></p>
<p class="MsoNormal" style="margin:0in;font-size:11pt;font-family:Calibri, sans-serif">
}<o:p> </o:p></p>
<p class="MsoNormal" style="margin:0in;font-size:11pt;font-family:Calibri, sans-serif">
<o:p> </o:p></p>
<p class="MsoNormal" style="margin:0in;font-size:11pt;font-family:Calibri, sans-serif">
using MyNoReturn = void (*) () noexcept;<o:p> </o:p></p>
<p class="MsoNormal" style="margin:0in;font-size:11pt;font-family:Calibri, sans-serif">
<o:p> </o:p><span style="font-family: Calibri, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);">//using MyNoReturn = std::add_pointer_t<decltype(abc)>;</span><o:p style="font-size: 11pt; font-style: inherit; font-variant-ligatures: inherit; font-variant-caps: inherit; font-weight: inherit;">
</o:p><o:p style="font-size: 11pt; font-style: inherit; font-variant-ligatures: inherit; font-variant-caps: inherit;"><b>// even this declaration, instead of the above, gives the same warning</b></o:p></p>
<p class="MsoNormal" style="margin:0in;font-size:11pt;font-family:Calibri, sans-serif">
<o:p> </o:p></p>
<p class="MsoNormal" style="margin:0in;font-size:11pt;font-family:Calibri, sans-serif">
[[noreturn]]<o:p> </o:p></p>
<p class="MsoNormal" style="margin:0in;font-size:11pt;font-family:Calibri, sans-serif">
inline void IDontReturn () noexcept<o:p> </o:p></p>
<p class="MsoNormal" style="margin:0in;font-size:11pt;font-family:Calibri, sans-serif">
{<o:p> </o:p></p>
<p class="MsoNormal" style="margin:0in;font-size:11pt;font-family:Calibri, sans-serif">
std::terminate ();<o:p> </o:p></p>
<p class="MsoNormal" style="margin:0in;font-size:11pt;font-family:Calibri, sans-serif">
}<o:p> </o:p></p>
<p class="MsoNormal" style="margin:0in;font-size:11pt;font-family:Calibri, sans-serif">
<o:p><br>
</o:p></p>
<p class="MsoNormal" style="margin:0in;font-size:11pt;font-family:Calibri, sans-serif">
<o:p><span style="background-color:rgb(255, 255, 255);display:inline !important">static MyNoReturn gvar {IDontReturn};</span><o:p style="background-color:rgb(255, 255, 255)"> </o:p> </o:p></p>
<p class="MsoNormal" style="margin:0in;font-size:11pt;font-family:Calibri, sans-serif">
</p>
<p class="MsoNormal" style="margin:0in;font-size:11pt;font-family:Calibri, sans-serif">
<o:p> </o:p></p>
<p class="MsoNormal" style="margin:0in;font-size:11pt;font-family:Calibri, sans-serif">
[[noreturn]]<o:p> </o:p></p>
<p class="MsoNormal" style="margin:0in;font-size:11pt;font-family:Calibri, sans-serif">
inline void<o:p> </o:p></p>
<p class="MsoNormal" style="margin:0in;font-size:11pt;font-family:Calibri, sans-serif">
CallIDontReturn () noexcept<o:p> </o:p></p>
<p class="MsoNormal" style="margin:0in;font-size:11pt;font-family:Calibri, sans-serif">
{<o:p> </o:p></p>
<p class="MsoNormal" style="margin:0in;font-size:11pt;font-family:Calibri, sans-serif">
gvar ();<o:p> // <b>here is where clang gives
<span style="color: rgb(37, 36, 35); font-family: "Segoe UI", system-ui, "Apple Color Emoji", "Segoe UI Emoji", sans-serif; font-size: 14px; background-color: rgb(255, 255, 255); display: inline !important;">
<i>warning: function declared 'noreturn' should not return [-Winvalid-noreturn]</i></span></b></o:p></p>
<p class="MsoNormal" style="margin:0in;font-size:11pt;font-family:Calibri, sans-serif">
<span style="font-family: Calibri, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);">}</span><o:p style="font-size: 11pt; font-style: inherit; font-variant-ligatures: inherit; font-variant-caps: inherit; font-weight: inherit;"> </o:p><br>
</p>
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
We have the used the below command to compile:</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="color: rgb(37, 36, 35); font-family: "Segoe UI", system-ui, "Apple Color Emoji", "Segoe UI Emoji", sans-serif; font-size: 14px;">clang++ -std=c++17 -Wall -o runusing usingst.cpp</span><br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="color: rgb(37, 36, 35); font-family: "Segoe UI", system-ui, "Apple Color Emoji", "Segoe UI Emoji", sans-serif; font-size: 14px;"><br>
</span></div>
<div style=""><font color="#252423" face="Segoe UI, system-ui, Apple Color Emoji, Segoe UI Emoji, sans-serif"><span style="font-size: 14px;">gcc does not show this warning.</span></font></div>
<div style=""><font color="#252423" face="Segoe UI, system-ui, Apple Color Emoji, Segoe UI Emoji, sans-serif"><span style="font-size: 14px;"><br>
</span></font></div>
<div style=""><font color="#252423" face="Segoe UI, system-ui, Apple Color Emoji, Segoe UI Emoji, sans-serif"><span style="font-size: 14px;">Please let us know how we can use 'using' clause to declare function pointer to a function that does not return, so
that this warning does not show up.</span></font></div>
<div style=""><font color="#252423" face="Segoe UI, system-ui, Apple Color Emoji, Segoe UI Emoji, sans-serif"><span style="font-size: 14px;"><br>
</span></font></div>
<div style=""><font color="#252423" face="Segoe UI, system-ui, Apple Color Emoji, Segoe UI Emoji, sans-serif"><span style="font-size: 14px;">Regards,</span></font></div>
<div style=""><font color="#252423" face="Segoe UI, system-ui, Apple Color Emoji, Segoe UI Emoji, sans-serif"><span style="font-size: 14px;">Manu </span></font></div>
</body>
</html>