Topic: include [[noreturn]] into function signature
Author: Aso Renji <asorenji@gmail.com>
Date: Tue, 29 Sep 2015 14:29:33 -0700 (PDT)
Raw View
------=_Part_6433_1697807517.1443562173046
Content-Type: multipart/alternative;
boundary="----=_Part_6434_898301163.1443562173046"
------=_Part_6434_898301163.1443562173046
Content-Type: text/plain; charset=UTF-8
Problem:
class parent
{
public:
virtual int some_method()const{error();}
[[noreturn]] virtual void error()const=0;
};
class child:public parent
{
[[noreturn]] void error()const{throw std::runtime_error("Error in
class child");}
};
[[noreturn]] is not a part of error method signature. So, i have "warning:
no return statement in function returning non-void" in some_method.
Proposal - include [[noreturn]] attribute to function signature. Sory if my
english is bad.
--
---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.
------=_Part_6434_898301163.1443562173046
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><p>Problem:<br></p><p>class parent<br>{</p><p>public:</p><=
p>=C2=A0 =C2=A0 virtual int some_method()const{error();}</p><p>=C2=A0 =C2=
=A0 [[noreturn]] virtual void error()const=3D0;<br>};<br></p><p><br></p><p>=
class child:public parent</p><p>{</p><p>=C2=A0 =C2=A0 =C2=A0[[noreturn]] vo=
id error()const{throw std::runtime_error("Error in class child");=
}<br>};<br></p><p>[[noreturn]] is not a part of error method signature. So,=
i have "warning: no return statement in function returning non-void&q=
uot; in some_method. Proposal - include [[noreturn]] attribute to function =
signature. Sory if my english is bad.</p></div>
<p></p>
-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
------=_Part_6434_898301163.1443562173046--
------=_Part_6433_1697807517.1443562173046--
.
Author: Nicol Bolas <jmckesson@gmail.com>
Date: Tue, 29 Sep 2015 14:47:29 -0700 (PDT)
Raw View
------=_Part_186_1719727515.1443563249582
Content-Type: multipart/alternative;
boundary="----=_Part_187_810777375.1443563249583"
------=_Part_187_810777375.1443563249583
Content-Type: text/plain; charset=UTF-8
On Tuesday, September 29, 2015 at 5:29:33 PM UTC-4, Aso Renji wrote:
>
> Problem:
>
> class parent
> {
>
> public:
>
> virtual int some_method()const{error();}
>
> [[noreturn]] virtual void error()const=0;
> };
>
>
> class child:public parent
>
> {
>
> [[noreturn]] void error()const{throw std::runtime_error("Error in
> class child");}
> };
>
> [[noreturn]] is not a part of error method signature. So, i have "warning:
> no return statement in function returning non-void" in some_method.
> Proposal - include [[noreturn]] attribute to function signature. Sory if my
> english is bad.
>
That's up to the compiler to decide whether to give you that warning.
You've done all you can to inform the compiler that the method doesn't need
a return statement.
--
---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.
------=_Part_187_810777375.1443563249583
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">On Tuesday, September 29, 2015 at 5:29:33 PM UTC-4, Aso Re=
nji wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left:=
0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr"><p>=
Problem:<br></p><p>class parent<br>{</p><p>public:</p><p>=C2=A0 =C2=A0 virt=
ual int some_method()const{error();}</p><p>=C2=A0 =C2=A0 [[noreturn]] virtu=
al void error()const=3D0;<br>};<br></p><p><br></p><p>class child:public par=
ent</p><p>{</p><p>=C2=A0 =C2=A0 =C2=A0[[noreturn]] void error()const{throw =
std::runtime_error("Error in class child");}<br>};<br></p><p>[[no=
return]] is not a part of error method signature. So, i have "warning:=
no return statement in function returning non-void" in some_method. P=
roposal - include [[noreturn]] attribute to function signature. Sory if my =
english is bad.</p></div></blockquote><div><br>That's up to the compile=
r to decide whether to give you that warning. You've done all you can t=
o inform the compiler that the method doesn't need a return statement.<=
br></div></div>
<p></p>
-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
------=_Part_187_810777375.1443563249583--
------=_Part_186_1719727515.1443563249582--
.
Author: Aso Renji <asorenji@gmail.com>
Date: Tue, 29 Sep 2015 15:00:46 -0700 (PDT)
Raw View
------=_Part_1055_1730560848.1443564047043
Content-Type: multipart/alternative;
boundary="----=_Part_1056_1566820063.1443564047043"
------=_Part_1056_1566820063.1443564047043
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
=D1=81=D1=80=D0=B5=D0=B4=D0=B0, 30 =D1=81=D0=B5=D0=BD=D1=82=D1=8F=D0=B1=D1=
=80=D1=8F 2015 =D0=B3., 0:47:29 UTC+3 =D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=
=D0=B2=D0=B0=D1=82=D0=B5=D0=BB=D1=8C Nicol Bolas =D0=BD=D0=B0=D0=BF=D0=B8=
=D1=81=D0=B0=D0=BB:
>
> That's up to the compiler to decide whether to give you that warning.=20
> You've done all you can to inform the compiler that the method doesn't ne=
ed=20
> a return statement.
>
Compiler think "[[noreturn]] is not a part of function signature. So,=20
maybe, overloaded version of virtual method don't have noreturn attribute.=
=20
So, i show warning about this". If noreturn become part of signature, all=
=20
overloaded version also inherited this. And warning disapered.
--=20
---=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.
------=_Part_1056_1566820063.1443564047043
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><br><br>=D1=81=D1=80=D0=B5=D0=B4=D0=B0, 30 =D1=81=D0=B5=D0=
=BD=D1=82=D1=8F=D0=B1=D1=80=D1=8F 2015 =D0=B3., 0:47:29 UTC+3 =D0=BF=D0=BE=
=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=D1=82=D0=B5=D0=BB=D1=8C Nicol Bolas =
=D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB:<blockquote class=3D"gmail_quote=
" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding=
-left: 1ex;"><div dir=3D"ltr">That's up to the compiler to decide wheth=
er to give you that warning. You've done all you can to inform the comp=
iler that the method doesn't need a return statement.<br></div></blockq=
uote><div>Compiler think "[[noreturn]] is not a part of function signa=
ture. So, maybe, overloaded version of virtual method don't have noretu=
rn attribute. So, i show warning about this". If noreturn become part =
of signature, all overloaded version also inherited this. And warning disap=
ered.</div></div>
<p></p>
-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
------=_Part_1056_1566820063.1443564047043--
------=_Part_1055_1730560848.1443564047043--
.