2

I'm getting this compile error

C:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\winrt\wrl\implements.h(1453): warning C4265: 'Microsoft::WRL::FtmBase': class has virtual functions, but destructor is not virtual

after adding "#include < wrl.h>" to my program. I'm using /W4 flag. Is there something that I'm missing here? some kind of macro that needs to be defined? Curious if there's a way to fix that warning without suppressing it.

Also, I'm using latest VS 2017 with c++17 if that helps.

bysreg
  • 793
  • 1
  • 9
  • 30
  • If a class has virtual methods, it is expecting to be a base class that can be derived from so those methods can be overridden. A base class without a virtual destructor is dangerous, as calling `delete` on a base class pointer will not call any derived class destructors. Sounds like an oversight on MS's part, unless `delete` is *never* called on a `FmtBase*` pointer (ie, if `FmtBase`-derived objects are *never* constructed with `new`), if `FmtBase*` pointers are *always* casted to a derived type before `delete` is called, or if a `FmtBase`-derived object calls its own destructor when released – Remy Lebeau Jul 10 '18 at 00:34
  • yea, very weird. I was interested in using the ComPtr class, and it seems that instead of including wrl.h, i can include #include which doesn't have that warning – bysreg Jul 10 '18 at 00:51
  • `FtmBase` is used by `RuntimeClass` which should never be `delete`d. It should be `Release`d. – Raymond Chen Jul 10 '18 at 04:27

0 Answers0