<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 --- - implicit conversions and const rvalues"
href="https://llvm.org/bugs/show_bug.cgi?id=27949">27949</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>implicit conversions and const rvalues
</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>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>eniebler@boost.org
</td>
</tr>
<tr>
<th>CC</th>
<td>dgregor@apple.com, llvm-bugs@lists.llvm.org
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>GCC accepts the code below. Clang rejects it in C++11 mode and higher, but
accepts it in C++98 mode. Who is right?
struct ovrMatrix4f {
};
class Matrix4 {
public:
operator const ovrMatrix4f () const {
ovrMatrix4f result;
return result;
}
};
void ok() {
Matrix4 from;
ovrMatrix4f to = from; // that one is fine
}
void bad() {
Matrix4 from;
ovrMatrix4f to;
to = from; // compilation fails here
}
Clang says:
test.cpp:20:8: error: no viable conversion from 'Matrix4' to 'ovrMatrix4f'
to = from; // compilation fails here
^~~~
test.cpp:1:8: note: candidate constructor (the implicit copy constructor) not
viable: no known conversion from 'Matrix4' to
'const ovrMatrix4f &' for 1st argument
struct ovrMatrix4f {
^
test.cpp:1:8: note: candidate constructor (the implicit move constructor) not
viable: no known conversion from 'Matrix4' to
'ovrMatrix4f &&' for 1st argument
struct ovrMatrix4f {
^
test.cpp:6:3: note: candidate function
operator const ovrMatrix4f () const {
^
test.cpp:1:8: note: passing argument to parameter here
struct ovrMatrix4f {
^</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>