<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><span class="vcard"><a class="email" href="mailto:richard-llvm@metafoo.co.uk" title="Richard Smith <richard-llvm@metafoo.co.uk>"> <span class="fn">Richard Smith</span></a>
</span> changed
          <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED INVALID - Incorrect arguments matching in a template class constructor"
   href="https://bugs.llvm.org/show_bug.cgi?id=33195">bug 33195</a>
          <br>
             <table border="1" cellspacing="0" cellpadding="8">
          <tr>
            <th>What</th>
            <th>Removed</th>
            <th>Added</th>
          </tr>

         <tr>
           <td style="text-align:right;">Status</td>
           <td>NEW
           </td>
           <td>RESOLVED
           </td>
         </tr>

         <tr>
           <td style="text-align:right;">CC</td>
           <td>
                
           </td>
           <td>richard-llvm@metafoo.co.uk
           </td>
         </tr>

         <tr>
           <td style="text-align:right;">Resolution</td>
           <td>---
           </td>
           <td>INVALID
           </td>
         </tr></table>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED INVALID - Incorrect arguments matching in a template class constructor"
   href="https://bugs.llvm.org/show_bug.cgi?id=33195#c1">Comment # 1</a>
              on <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED INVALID - Incorrect arguments matching in a template class constructor"
   href="https://bugs.llvm.org/show_bug.cgi?id=33195">bug 33195</a>
              from <span class="vcard"><a class="email" href="mailto:richard-llvm@metafoo.co.uk" title="Richard Smith <richard-llvm@metafoo.co.uk>"> <span class="fn">Richard Smith</span></a>
</span></b>
        <pre>This code is ill-formed.

Default argument instantiation is not in the immediate context of the
substitution (confirmed recently in committee discussion of core issue 2202).
During overload resolution, the copy constructor of Outer is considered, using
{{1, "a"}, {2, "b"}} to initialize a temporary Outer object, and while
considering the initialization of that temporary object, we consider
initializing a Middle object from the expression 1, which results in
instantiating the default argument expression for the 

  Middle(const int&, const T& = {})

constructor (with T = Inner). That instantiation fails, because {} cannot be
converted to type Inner. You can see the same thing by trying this:

  bool k = std::is_constructible<Middle<Inner>, int &&>::value;

Essentially, by writing a templated function with a default argument that fails
to instantiate, you have written non-SFINAE-friendly code, which in effect sets
up a trap that will render any attempt at using that function ill-formed in a
way that SFINAE cannot detect.

You can fix your code by replacing the constructor with the invalid default
argument with a pair of constructors:

  Middle(const int &, const T &) {}
  Middle(const int &n) : Middle(n, {}) {}</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>