Is std::byte well defined? : <p>C++17 introduces the <code>std::byte</code> type. A library type that can (supposedly) be used to access raw memory, but stands separate from the character types and represents a mere lump of bits.</p>

<p>So far so good. But the definition has me slightly worried. As given in <a href="http://eel.is/c++draft/cstddef.syn#lib:byte" rel="noreferrer">[cstddef.syn]</a>:</p>

<pre><code>enum class byte : unsigned char {};
</code></pre>

<p>I have seen two answers on SO which seem to imply different things about the robustness of the above. <a href="https://stackoverflow.com/a/44508267/817643">This answer</a> argues (without reference) that an enumeration with an underlying type has the same size and alignment requirements as said type. Intuitively this seems correct, since specifying an underlying type allows for opaque enum declarations.</p>

<p>However, <a href="https://stackoverflow.com/a/45056142/817643">this answer</a> argues that the standard only guarantees that two enumerations with the same underlying type are layout compatible, and no more.</p>

<p>When reading <a href="http://eel.is/c++draft/dcl.enum" rel="noreferrer">[dcl.enum]</a> I couldn't help but notice that indeed, the underlying type is only used to specify the range of the enumerators. There is no mention of size or alignment requirements.</p>

<p>What am I missing?</p>
