Topic: Suggestion for a compile-time error if a
Author: Olaf van der Spek <olafvdspek@gmail.com>
Date: Mon, 24 Mar 2014 21:12:01 +0100
Raw View
On Mon, Mar 24, 2014 at 9:07 PM, Willem Semmelink <wsemmelink@gmail.com> wrote:
>
>
>>>
>>> At least gcc already has a flag to do this: -Werror=virtual-dtor.
>>
>>
>> MSVC++ as well, since at least 2003.
>> C4265: 'class' : class has virtual functions, but destructor is not
>> virtual
>>
> Thanks everyone for your replies.
>
> I am really glad to learn this is actually implemented in gcc and MSVC. I
> did not know that.
> I tried a quick test in VC2013 Express, but it compiled successfully (also
> no warnings). Is it something that I have to enable in MSVC?
/Wall, though that will result in 800 lines of 'warnings'.
1>c:\vc\temp\t0\t0.cpp(13): warning C4265: 'Animal' : class has
virtual functions, but destructor is not virtual
1> instances of this class may not be destructed correctly
1>c:\vc\temp\t0\t0.cpp(20): warning C4265: 'Dog' : class has virtual
functions, but destructor is not virtual
1> instances of this class may not be destructed correctly
--
---
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/.
.
Author: wsemmelink@gmail.com
Date: Mon, 24 Mar 2014 13:46:34 -0700 (PDT)
Raw View
------=_Part_649_16883115.1395693994720
Content-Type: text/plain; charset=UTF-8
>
> /Wall, though that will result in 800 lines of 'warnings'.
>
>
>
Thanks Olaf, I made my last post before yours came through.
It looks like I could do the check with /W3, and it then fortunately did
not generate hundreds of warnings - only the two 4265 warnings.
I was also able to elevate them to error level with
#pragma warning(error:4265)
Thanks, everyone, I hope this thread did not waste your time, as I
certainly learned something very useful, and I hope it may help someone
else also landing here via a search.
--
---
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_649_16883115.1395693994720
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"> <br><blockquote class=3D"gmail_quote" style=3D"margi=
n: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">
<br>/Wall, though that will result in 800 lines of 'warnings'.
<br>
<br> <br></blockquote><div>Thanks Olaf, I made my last post before you=
rs came through. <br>It looks like I could do the check with /W3, and it th=
en fortunately did not generate hundreds of warnings - only the two 4265 wa=
rnings. <br>I was also able to elevate them to error level with<br>#pragma =
warning(error:4265)<br><br>Thanks, everyone, I hope this thread did not was=
te your time, as I certainly learned something very useful, and I hope it m=
ay help someone else also landing here via a search.<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_649_16883115.1395693994720--
.