title: Is enum E { a } e = E(2); valid?
body: <p>A recent and interesting C language-lawyer question asked:</p>
  <ul>
  <li><a href="https://stackoverflow.com/questions/70988698/is-enum-a-e-1-valid">Is enum { a } e = 1; valid?</a></li>
  </ul>
  <p>This Q&amp;A asks the same question for the similar cases for C++<sup>(*)</sup>: are these valid?</p>
  <pre><code>enum EA { a } ea = EA(2);               // #1
  enum EB { b } eb = static_cast&lt;EB&gt;(2);  // #2
  </code></pre>
  <p><sup>I've already noted that the variation <code>enum EC { c } ec = EC{2};</code> is rejected at compile time (&quot;cannot initialize a value of type '<code>E</code>' with an rvalue of type '<code>int</code>'), whereas <code>#1</code> and <code>#2</code> are accepted, ruling out ill-formed but not ill-formed NDR and UB for <code>#1</code> and <code>#2</code>.</sup></p>
  <hr />
  <p><sup>(*) Posted here as a self-answered Q&amp;A after being prompted to break out overly eager and misplaced C++-focused answer to the original C language-lawyer question.</sup></p>