Fix build on NetBSD: Mark destructors of few classes as virtual
authorKamil Rytarowski <n54@gmx.com>
Wed, 3 Feb 2016 01:51:08 +0000 (02:51 +0100)
committerKamil Rytarowski <n54@gmx.com>
Wed, 3 Feb 2016 02:02:20 +0000 (03:02 +0100)
commitaa032bb0d1eb952bdac3453c63e077bdf43fe952
tree02ebd59ee81bcef03156d372d1298a3e83e5cdcd
parent0763592867d3d8179503ce380d8eb45683a4e421
Fix build on NetBSD: Mark destructors of few classes as virtual

In the DeleteInteropSafe function there is accepted a class type (template):

    template<class T> void DeleteInteropSafe(T *p)

Inside this function there is a call of a destructor:

    p->~T();

Recent Clang/LLVM is upset when the passed T class doesn't contain a virtual
destructor.

Example error message:

In file included from /tmp/pkgsrc-tmp/wip/coreclr-git/work/coreclr/src/debug/ee/debugger.cpp:13:
In file included from /tmp/pkgsrc-tmp/wip/coreclr-git/work/coreclr/src/debug/ee/stdafx.h:33:
/tmp/pkgsrc-tmp/wip/coreclr-git/work/coreclr/src/debug/ee/debugger.h:3652:9: error: destructor called on non-final 'DebuggerPendingFuncEvalTable' that has virtual functions but non-virtual destructor [-Werror,-Wdelete-non-virtual-dtor]
        p->~T();
        ^
/tmp/pkgsrc-tmp/wip/coreclr-git/work/coreclr/src/debug/ee/debugger.cpp:1310:13: note: in instantiation of function template specialization 'DeleteInteropSafe<DebuggerPendingFuncEvalTable>' requested here
            DeleteInteropSafe(pPendingEvals);
            ^
/tmp/pkgsrc-tmp/wip/coreclr-git/work/coreclr/src/debug/ee/debugger.h:3652:13: note: qualify call to silence this warning
        p->~T();
            ^
            DebuggerPendingFuncEvalTable::

Reported and fixed on:
$ uname -a
NetBSD chieftec 7.99.25 NetBSD 7.99.25 (GENERIC) #0: Fri Dec 25 20:51:06 UTC 2015  root@chieftec:/tmp/netbsd-tmp/sys/arch/amd64/compile/GENERIC amd64

$ clang --version
clang version 3.9.0
Target: x86_64-unknown-netbsd7.99.25
Thread model: posix
InstalledDir: /usr/pkg/bin
$ llvm-config --version
3.9.0svn
src/debug/ee/controller.h
src/debug/ee/debugger.h