<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - failure to diagnose ambiguity in conditional between glvalue and prvalue"
   href="http://llvm.org/bugs/show_bug.cgi?id=19160">19160</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>failure to diagnose ambiguity in conditional between glvalue and prvalue
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>C++11
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>richard-llvm@metafoo.co.uk
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dgregor@apple.com, llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Consider:

struct B;
struct A { A(); A(B&) = delete; operator B&(); };
struct B : A {} b;
B &c = true ? A() : b;

The A prvalue converts to a B lvalue, and the B lvalue satisfies the rules for
converting to an A prvalue. 5.16/3 bullet 3 bullet 1 is clear that we only
actually copy-initalize a temporary of type A from 'b' "if the conversion is
applied", which it isn't in this case, because we hit the ambiguity first.

So we should reject this due to ambiguity, instead of accepting it and picking
the non-deleted conversion sequence. Both GCC and EDG reject.


Here's a more exciting case:

struct B;
struct A { A(); A(B&); operator B&() = delete; };
struct B : A {} b;
B &c = true ? A() : b;

Here, we should either claim ambiguity or convert 'b' to an A prvalue
(depending on whether the "can be implicitly converted" check in 5.16/3 bullet
1 cares about deletedness or not) -- the standard is not clear which (and a
literal reading suggests this way round is valid!); we convert the 'A'
temporary to a B lvalue!</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>