Issue 104749
Summary Incorrect std::is_trivially_copy_constructible result
Labels new issue
Assignees
Reporter Fedr
    This program
```c++
#include <type_traits>

struct MoveOnly
{
    MoveOnly()  = default;
 ~MoveOnly() = default;

    MoveOnly(const MoveOnly&)            = delete;
    MoveOnly& operator=(const MoveOnly&) = delete;

 MoveOnly(MoveOnly&&) noexcept            = default;
    MoveOnly& operator=(MoveOnly&&) noexcept = default;
};

template <typename T>
struct Wrapper
{
    Wrapper(const Wrapper&)
 requires(!std::is_trivially_copy_constructible_v<T> && std::is_copy_constructible_v<T>) 
    {
    }

    Wrapper(const Wrapper&)
        requires(std::is_trivially_copy_constructible_v<T>) = default;
};

static_assert(not std::is_trivially_copy_constructible_v<MoveOnly>);
static_assert(not std::is_copy_constructible_v<MoveOnly>);
static_assert( std::is_trivially_copyable_v<MoveOnly>);

static_assert(not std::is_trivially_copy_constructible_v<Wrapper<MoveOnly>>);
static_assert(not std::is_copy_constructible_v<Wrapper<MoveOnly>>);
static_assert( std::is_trivially_copyable_v<Wrapper<MoveOnly>>);
```
is accepted by GCC and MSVC, but Clang rejects the last `static_assert`. Online demo: https://gcc.godbolt.org/z/f8343qe3h

Related discussion: https://stackoverflow.com/q/78885178/7325599
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to