Skip to content

[Clang] Clang sometimes fails to propagate deletion of special member functions from an unnamed struct #167217

@frederick-vs-ja

Description

@frederick-vs-ja

Currently, for the following example. Clang doesn't think the copy/move constructors of Wrapper2 (a class template specialization) are deleted, while it (probably correctly) thinks copy/move constructors of Wrapper (a non-template class) are deleted.

Other compilers seemingly correctly propagate the deletion (when unnamed struct is enabled). https://godbolt.org/z/MeqMMGncG

struct NonMovable {
  NonMovable(const NonMovable&) = delete;
};

struct Wrapper {
  struct {
    NonMovable v;
  };
};

static_assert(!__is_constructible(Wrapper, const Wrapper&));
static_assert(!__is_constructible(Wrapper, Wrapper));

template<class T>
struct WrapperTmpl {
  struct {
    NonMovable v;
  };
};

using Wrapper2 = WrapperTmpl<NonMovable>;

static_assert(!__is_constructible(Wrapper2, const Wrapper2&)); // Clang thinks Wrapper2 is copy constructible (?)
static_assert(!__is_constructible(Wrapper2, Wrapper2));        // Clang thinks Wrapper2 is move constructible (?)

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang:frontendLanguage frontend issues, e.g. anything involving "Sema"diverges-from:edgDoes the clang frontend diverge from edg compiler on this issuediverges-from:gccDoes the clang frontend diverge from gcc on this issuediverges-from:msvcDoes the clang frontend diverge from msvc on this issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions