<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/54067>54067</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            <type_traits> std::is_trivially_copyable_v returns true with a non-copyable non-moveable type
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          alexkaratarakis
      </td>
    </tr>
</table>

<pre>
    Min repro:

```C++
#include <type_traits>

// std::atomic<int> is an example of this
struct MockTriviallyCopyableButNotCopyableOrMoveable
{
    MockTriviallyCopyableButNotCopyableOrMoveable() = default;

    constexpr MockTriviallyCopyableButNotCopyableOrMoveable(const MockTriviallyCopyableButNotCopyableOrMoveable& other) noexcept = delete;
    constexpr MockTriviallyCopyableButNotCopyableOrMoveable(MockTriviallyCopyableButNotCopyableOrMoveable&& other) noexcept = delete;

    constexpr MockTriviallyCopyableButNotCopyableOrMoveable& operator=(
        const MockTriviallyCopyableButNotCopyableOrMoveable& other) noexcept = delete;
    constexpr MockTriviallyCopyableButNotCopyableOrMoveable& operator=(MockTriviallyCopyableButNotCopyableOrMoveable&& other) noexcept =
        delete;
};

static_assert(std::is_trivially_copyable_v<MockTriviallyCopyableButNotCopyableOrMoveable>);
```


`clang` deems the class as trivially copyable, even though it is neither copyable nor moveable.
`gcc` agrees with `clang`,  `msvc` rejects it, as can be seen in https://godbolt.org/z/nM8h37qMY

According to the spec:


"""
11.2 Properties of classes [class.prop]/p1:

A trivially copyable class is a class:
(1.1) - that has at least one eligible copy constructor, move constructor, copy assignment operator, or move
assignment operator (11.4.4, 11.4.5.3, 11.4.6),
(1.2) - where each eligible copy constructor, move constructor, copy assignment operator, and move assignment operator is trivial, and
(1.3) - that has a trivial, non-deleted destructor (11.4.7).

11.4.4 Special member functions [special]/p6 states:

An eligible special member function is a special member function for which:
(6.1) - the function is not deleted,
(6.2) - the associated constraints (13.5), if any, are satisfied, and
(6.3) - no special member function of the same kind is more constrained (13.5.5).

In the min-repro, every special member function is deleted (6.1) and hence the class does not have at least one eligible copy/move constructor or copy/move assignment operator (1.1).
"""


Reference:
https://developercommunity.visualstudio.com/t/msvc-discrepancy-for-std::is_trivially_c/1672465?space=62&scope=follow
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzNVk2P8jYQ_jXhYhGRT-DAYRe6Ug-0VdtLTyvHGYi7jp3aDiz99R07CQReaIu6h6KQ2PF45plnPpxClafVlkuiodEqSF6C2SaYDfd81l3rIH51V_c2Trhkoi2BBMnanhp4t5pya4Lku6vd8RtexNjSqU1eqFU1Z7iFS4uihBtCJYFPWjcCiNoRW3HTbTVWt8ySrWIfv2p-4FSI01o1J1oIeG3tD8oOsx_1Vh3AjXqj8x4lwd9z--NFEC_RpQ0pYUdbgSBfx_44jUxJY-Gz0U_r9juf3ZUTZSvQDpdU8MmgsT1AARbO-P4bsmcx_WtYXwAOLTWgMXM06ncROqs8q_0_cnoL-8sovvb_lu_55oZ7Y6nl7J0aA9oijnMtcoM12-N5Zz2E9wMW53NQseLj5cXo0C-u2sCwxASVe3wibKgNVjsQfGWwC-BksEgGMEG8JnAAiXKq3VeEW9cwJHBHy1kKydGk7tGEZ1N7xpwhutcAhhxxDxkBcKrdvDYHL6bhd2DWoAm3gmgY9qUCiAE0j62xsrYxjjff0PaqLJSwodJ7nP2Jf7ldVMn8j-1vY4dfGFO65HJPrPK-mgbYbX_t-2TcX34aRWFMftIugSxH9NgYPU04DLJXPwyxVTdBhpn11kQ3Ol_ucNnz7BpuN7zsiRdRGLksmyJIakmF7uNDAMXKUhIICL7nXgcq6yrC9WbMbOTKMX_7zsuhDb6XNUh7qQRc64PV2b4jQxyeKEzD1En7URYm53Huki1ej6DHHfQj5gRCpaz6WrxUlt2ee1j5OW170RGu5JbSsahUctqVbom1MGA5-z7HveE4pB0j5BdMINRAaqgLLIFdK5nl6It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