title: Does the C++ standard guarantee that uniform initialization is exception-safe?
body: <pre><code>#include &lt;iostream&gt;
  
  using namespace std;
  
  struct A
  {
      A() { cout &lt;&lt; "A" &lt;&lt; endl; }
      ~A() { cout &lt;&lt; "~A" &lt;&lt; endl; }
  };
  
  A Ok() { return {}; }
  A NotOk() { throw "NotOk"; }
  
  struct B
  {
      A a1;
      A a2;
  };
  
  void f(B) {}
  
  int main()
  {
      try
      {
          f({ Ok(), NotOk() });
      }
      catch (...)
      {}
  }
  </code></pre>
  
  <p><code>vc++</code> and <code>clang</code> output:</p>
  
  <pre><code>A
  ~A
  </code></pre>
  
  <p>While <code>gcc</code> outputs:</p>
  
  <pre><code>A
  </code></pre>
  
  <p>It seems a serious bug of GCC.</p>
  
  <p>For reference, see <a href="https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66139" rel="noreferrer">GCC bug 66139</a> and <a href="https://akrzemi1.wordpress.com/2017/04/27/a-serious-bug-in-gcc/" rel="noreferrer">"A serious bug in GCC" by Andrzej Krzemieński</a>.</p>
  
  <p>I just wonder:</p>
  
  <p><strong>Does the C++ standard guarantee that uniform initialization is exception-safe?</strong></p>