[LLVMbugs] [Bug 20268] New: virtual deleted functions appear to be callable.

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Jul 9 13:47:22 PDT 2014


            Bug ID: 20268
           Summary: virtual deleted functions appear to be callable.
           Product: clang
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: mclow.lists at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

#include <iostream>
#include <type_traits>

struct DeletedVirtualPublicDestructor    { public:    virtual
~DeletedVirtualPublicDestructor() = delete; };
struct DeletedVirtualProtectedDestructor { protected: virtual
~DeletedVirtualProtectedDestructor() = delete; };
struct DeletedVirtualPrivateDestructor   { private:   virtual
~DeletedVirtualPrivateDestructor() = delete; };

struct __two {char __lx[2];};

template <typename _Tp>
struct __is_destructor_wellformed {
    template <typename _Tp1, typename _Tp2 =
    static char  __test (int);

    template <typename _Tp1>
    static __two __test (...);

    static const bool value = sizeof(__test<_Tp>(12)) == sizeof(char);

int main () {
    std::cout <<
__is_destructor_wellformed<DeletedVirtualPublicDestructor>::value << std::endl;

I expect this code to print '0', but it prints '1'.
Note that if I remove the "virtual" from DeletedVirtualPublicDestructor, it
prints '0'.

Tested with:
   clang version 3.5.0 (trunk 212619)
   Target: x86_64-apple-darwin13.3.0

You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20140709/2474267b/attachment.html>

More information about the llvm-bugs mailing list