<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 --- - rvalue overload hides the const lvalue one?"
   href="http://llvm.org/bugs/show_bug.cgi?id=16682">16682</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>rvalue overload hides the const lvalue one?
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>trunk
          </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>marc.glisse@normalesup.org
          </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>struct A{};
struct B{operator const A()const;};
void f(A const&);
#ifdef ERR
void f(A&&);
#endif
int main(){
  B a;
  f(a);
}

Compiled with clang++ -std=c++11, it is happy. If I add -DERR, clang++
complains:

l.cc:9:5: error: no viable conversion from 'B' to 'A'
  f(a);
    ^
l.cc:1:8: note: candidate constructor (the implicit copy constructor) not
      viable: no known conversion from 'B' to 'const A &' for 1st argument
struct A{};
       ^
l.cc:1:8: note: candidate constructor (the implicit move constructor) not
      viable: no known conversion from 'B' to 'A &&' for 1st argument
struct A{};
       ^
l.cc:2:10: note: candidate function
struct B{operator const A()const;};
         ^
l.cc:5:11: note: passing argument to parameter here
void f(A&&);
          ^
1 error generated.

The error message is not very helpful, and g++ accepts the code. This happens
quite easily with the standard library (list::push_front for instance).</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>