[LLVMbugs] [Bug 11983] New: is_polymorphic does not work with classes/structs declared final
    bugzilla-daemon at llvm.org 
    bugzilla-daemon at llvm.org
       
    Sat Feb 11 07:01:54 PST 2012
    
    
  
http://llvm.org/bugs/show_bug.cgi?id=11983
             Bug #: 11983
           Summary: is_polymorphic does not work with classes/structs
                    declared final
           Product: libc++
           Version: unspecified
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: All Bugs
        AssignedTo: hhinnant at apple.com
        ReportedBy: jonathan.sauer at gmx.de
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified
Created attachment 8041
  --> http://llvm.org/bugs/attachment.cgi?id=8041
svn diff of the patch
The following program does not compile with clang r150076 and libc++ r150085:
#include <type_traits>
struct Final final { };
static_assert(!std::is_polymorphic<Final>::value, "");
This results in:
$ $ ~/LLVM/build/Release+Asserts/bin/clang++ -std=c++0x -stdlib=libc++
clang.cpp 
In file included from clang.cpp:1:
/usr/include/c++/v1/type_traits:774:56: error: base 'Final' is marked 'final'
template <class _Tp> struct __is_polymorphic1 : public _Tp {};
                                                       ^
/usr/include/c++/v1/type_traits:779:38: note: in instantiation of template
class
      'std::__1::__is_polymorphic1<Final>' requested here
    : public integral_constant<bool, sizeof(__is_polymorphic1<_Tp>) == ...
                                     ^
/usr/include/c++/v1/type_traits:784:14: note: in instantiation of template
class
      'std::__1::__libcpp_polymorphic<Final, true>' requested here
    : public __libcpp_polymorphic<_Tp> {};
             ^
clang.cpp:5:21: note: in instantiation of template class
'std::__1::is_polymorphic<Final>' requested
      here
static_assert(!std::is_polymorphic<Final>::value, "");
                    ^
clang.cpp:3:8: note: 'Final' declared here
struct Final final { };
       ^
clang.cpp:5:53: error: expected unqualified-id
static_assert(!std::is_polymorphic<Final>::value, "");
                                                    ^
2 errors generated.
This is similar to Bug 11459, where is_empty did not work with final
classes/structs.
The attached patch fixes this bug by using __is_polymorphic if available.
-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
    
    
More information about the llvm-bugs
mailing list