<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><span class="vcard"><a class="email" href="mailto:lichray@gmail.com" title="Zhihao Yuan <lichray@gmail.com>"> <span class="fn">Zhihao Yuan</span></a>
</span> changed
          <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED INVALID - cosntexpr constructor breaks out expression SFINAE"
   href="https://bugs.llvm.org/show_bug.cgi?id=42330">bug 42330</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;">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 - cosntexpr constructor breaks out expression SFINAE"
   href="https://bugs.llvm.org/show_bug.cgi?id=42330#c6">Comment # 6</a>
              on <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED INVALID - cosntexpr constructor breaks out expression SFINAE"
   href="https://bugs.llvm.org/show_bug.cgi?id=42330">bug 42330</a>
              from <span class="vcard"><a class="email" href="mailto:lichray@gmail.com" title="Zhihao Yuan <lichray@gmail.com>"> <span class="fn">Zhihao Yuan</span></a>
</span></b>
        <pre>(In reply to Richard Smith from <a href="show_bug.cgi?id=42330#c5">comment #5</a>)
<span class="quote">> 
> I think what's going on here is:

>  * When initializing the array, Clang and GCC think the conversion from the
> list element to the array element type happens "inside" the braces
>  * When initializing the class with the constructor, Clang (but not GCC)
> thinks the conversion from the list element to the parameter type happens
> "outside" the braces

> Unfortunately, I think that the second point is a bug. Consider a case such
> as this:

>   template<int N> struct X {
>     constexpr operator int() { return N; };
>   };

>   using V = __best_match_t<X<123>, short>;

> Here, in order to tell whether the list-initialization is valid, we may need
> to evaluate the call to X<123>::operator int(), so we should instantiate it.</span >

Agreed.

<span class="quote">> So I think your workaround just "happens to work". (And it doesn't work for
> GCC, which only accepts the above case [...]</span >

Yes, the intention is to reject V.

So the conclusion in my mind is that this constructor

  template <class U>
  constexpr
  MyPtr(MyPtr<U> v) : ptr_(v.ptr_) {}

is just not sfinae-friendly.</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>