[LLVMbugs] [Bug 11461] New: std::tuple chokes on final

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Dec 1 03:33:15 PST 2011


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

             Bug #: 11461
           Summary: std::tuple 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


The following code does not compile:

  #include <utility>

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

  int main()
  {
    std::tuple<A> x; // #1
    std::tuple<B> y; // #2
  }

This currently happens because of a problem in std::is_empty<> that has been
reported as bug #11459. However even if we fix std::is_empty<>, only line #2
will compile. Line #1 will still trigger an error, because std::tuple will
attempt to derive from the empty class type A, which is forbidden.

In order to fix the problem we should disable the empty base optimization for
final classes. To achieve that, we need either an __is_final intrinsic or a
(possibly library-only) trait to check if derivation from a type T is actually
possible.

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