<html>
    <head>
      <base href="https://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 --- - user-defined conversion function allows cast to reference" href="https://urldefense.proofpoint.com/v2/url?u=https-3A__llvm.org_bugs_show-5Fbug.cgi-3Fid-3D24131&d=AwMBaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=pF93YEPyB-J_PERP4DUZOJDzFVX5ZQ57vQk33wu0vio&m=H7B6Y6JZw7AjaaVpA9CC5aTGzft9HH6Fal6mHXDaY84&s=ZRvQmCF1VzHqK6Ggb6XYBv3Ojiem9no5B7w2bgsAIFk&e=">24131</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>user-defined conversion function allows cast to reference
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>3.6
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>Linux
          </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>barry.revzin@gmail.com
          </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 the following code, slightly simplified from SO question
(<a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__stackoverflow.com_q_31428980_2069064&d=AwMBaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=pF93YEPyB-J_PERP4DUZOJDzFVX5ZQ57vQk33wu0vio&m=H7B6Y6JZw7AjaaVpA9CC5aTGzft9HH6Fal6mHXDaY84&s=LoOlQPuhrmV5FcLNz21qe33LS6svR4_-NmuFhVp8i9M&e=">http://stackoverflow.com/q/31428980/2069064</a>):

#include <string>

struct S
{
    std::string s;
    explicit operator std::string() const { return s; }
};


int main() 
{
    static_cast<std::string const&>(S{"hi"});
}

According to [over.match.conv], the candidate conversion functions are those
that "yield type T or a type that can be converted to type T via a standard
conversion sequence." But S does not have a conversion function that yields
std::string const& and the conversion from std::string to std::string const& is
not a standard conversion sequence. This code should be rejected (which gcc
does).</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>