Skip to content

satisfaction of constraint 'move_constructible<_Tp>' depends on itself #149443

Open
@G-M-twostay

Description

@G-M-twostay

Using clang 20.1.0 with -std=c++20. I've boiled down the problem to the case below.

#include <type_traits>
#include <concepts>
struct A{
    template <std::copyable T>
    operator T()const noexcept{
        return T{};
    }
};
template<std::copyable T1,std::copyable T0>
T1 f(T0 v){
    return v;
}
int main()
{
    f<int>(A{});
}

entire stack trace appears quite long, but the problem started at

<source>:4:15: note: while checking the satisfaction of concept 'copyable<A>' requested here
    4 |     template <std::copyable T>

and turned into

.../concepts:275:24: error: satisfaction of constraint 'copy_constructible<_Tp>' depends on itself
  275 |     concept copyable = copy_constructible<_Tp> && movable<_Tp>

. Thus, changing std::copyable in line 4 to typename or class fixes the issue.

https://godbolt.org/z/5q3M3GvEY

GCC 14.3 and 15.1 compiles this just fine.

This issue looks similar to #134880 , but I'm not sure if they are the same issue, can any1 confirm?

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang:frontendLanguage frontend issues, e.g. anything involving "Sema"conceptsC++20 conceptsdiverges-from:edgDoes the clang frontend diverge from edg compilerdiverges-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