Skip to content

Support for pointers to incomplete types  #34

@mgieseki

Description

@mgieseki

First of all, thank you for providing this implementation of std::variant. It's great to have a lightweight alternative to boost::variant available in C++11.
I just stumbled over an issue with recursive type definitions, and I'm not sure whether it's a limitation of C++11 or the variant implementation. The following struct definition compiles fine with GCC's and Clang's C++17 support:

struct S {
    std::variant<
        std::map<int, S>*
    > var;
};

When replacing std::variant with mpark::variant, I get an error message regarding the incomplete type S of std::pair<int, S>::second. Is it possible to enhance your implementation so that this kind of recursive type definition compiles with mpark::variant under C++11 as well?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions