Skip to content

std::tuple chokes on final #11833

@llvmbot

Description

@llvmbot
Bugzilla Link 11461
Resolution FIXED
Resolved on Dec 11, 2011 14:31
Version unspecified
OS All
Reporter LLVM Bugzilla Contributor

Extended Description

The following code does not compile:

#include

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

int main()
{
std::tuple x; // #​1
std::tuple 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugzillaIssues migrated from bugzillalibc++libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions