http://llvm.org/bugs/show_bug.cgi?id=20268

            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: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]
    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 =
decltype(std::declval<_Tp1&>().~_Tp1())>
    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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to