Skip to content

Clang disregards deleted copy constructor #56361

@tomboehmer

Description

@tomboehmer

https://godbolt.org/z/e6MPqErrh

#include <concepts>

struct Outcome;

struct Fn {
	Fn(Fn const&) = delete;

	template<typename F>
		requires (not std::same_as<Fn, std::remove_reference_t<F>>)
		     and std::invocable<F>
	Fn(F&& f);

	Outcome operator()() const;
};

struct Work {
	Fn fn;
};

int main() {
}

While declaring the implicit copy constructor for Work clang considers the templated constructor of Fn even though Fn declares a deleted copy constructor.

Using libc++ this becomes apparent evaluating std::invocable<const Fn&> when Outcome is used before it is defined, triggering a compilation error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang:frontendLanguage frontend issues, e.g. anything involving "Sema"conceptsC++20 concepts

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions