title: if-with-initializer in structured binding declaration example ill formed?
body: <p>I was reading through the <a href="https://en.cppreference.com/w/cpp/language/structured_binding" rel="nofollow noreferrer">Structured binding declaration on cppreference.com</a></p>
  <p>I thought I was doing well understanding the examples until I reached the last example at the bottom.</p>
  <pre><code>#include &lt;set&gt;
  #include &lt;string&gt;
  #include &lt;iomanip&gt;
  #include &lt;iostream&gt;
  
  int main() {
      std::set&lt;std::string&gt; myset;
      
      if (auto [iter, success] = myset.insert(&quot;Hello&quot;); success) 
          std::cout &lt;&lt; &quot;insert is successful. The value is &quot; &lt;&lt; 
          std::quoted(*iter) &lt;&lt; '\n';
      else
          std::cout &lt;&lt; &quot;The value &quot; &lt;&lt; std::quoted(*iter) &lt;&lt; &quot; already 
          exists in the set\n&quot;;
  }
  </code></pre>
  <p>At first glance it looked all right, but the more I looked at it the less I understood the if clause.</p>
  <p>At the top are the possible forms listed as:</p>
  <blockquote>
  <p>attr(optional) cv-auto ref-operator(optional) [ identifier-list ] = expression ;   (1)</p>
  <p>attr(optional) cv-auto ref-operator(optional) [ identifier-list ] { expression } ; (2)</p>
  <p>attr(optional) cv-auto ref-operator(optional) [ identifier-list ] ( expression ) ; (3)</p>
  </blockquote>
  <p>To me it looks like to be of deduction type (1). But it kind of makes no sense to me cause of</p>
  <blockquote>
  <p>expression    -   an expression that does not have the comma operator at the top level (grammatically, an assignment-expression), and has either array or non-union class type. If expression refers to any of the names from identifier-list, the declaration is ill-formed.</p>
  </blockquote>
  <p>which says that the declaration is ill formed if the expression is in the identifier list. So this looks to me that success isn't part of expression. If this would be the case then</p>
  <pre><code>auto [iter, success] = myset.insert(&quot;Hello&quot;);
  </code></pre>
  <p>would only assign the inserted <code>&quot;Hello&quot;</code> to <code>iter</code> and <code>success</code> would be what?!? The other way around it would violate the expression part. But it clearly compiles and runs so I must be missing something</p>