[LLVMbugs] [Bug 11459] New: is_empty<> chokes on final

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Dec 1 00:18:38 PST 2011


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

             Bug #: 11459
           Summary: is_empty<> chokes on final
           Product: libc++
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
        AssignedTo: hhinnant at apple.com
        ReportedBy: ganesh at barbati.net
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Created attachment 7660
  --> http://llvm.org/bugs/attachment.cgi?id=7660
Patch to make is_empty use the __is_empty intrinsic, if available

The following code will not compile:

  #include <type_traits>

  struct A final {};
  struct B { virtual ~B() final; };

  int main()
  {
    std::is_empty<A>::value;
    std::is_empty<B>::value;
  }

The error messages being:

  type_traits:787:14: error: base 'A' is marked 'final' [3]
  type_traits:786:8: error: declaration of '~__is_empty1' overrides a 'final'
function [3]

The current implementation if is_empty<> uses a technique that assumes every
class type can be derived from, but in presence of final that is no longer
true. I am attaching a patch that makes is_empty<> use the __is_empty intrinsic
function if it is available, as the intrinsic doesn't have this problem.

-- 
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