<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 --- - Compiler warns about inaccessible copy constructor when binding a reference to a temporary"
href="http://llvm.org/bugs/show_bug.cgi?id=15328">15328</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Compiler warns about inaccessible copy constructor when binding a reference to a temporary
</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>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>C++
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>dicomj23@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>Binding a reference to temporary doesn't require a copy constructor at all:
$ clang --version && cat main.cpp && clang -std=c++98 -Wall main.cpp
clang version 3.3 (trunk 175738)
Target: i386-pc-linux-gnu
Thread model: posix
int main() {
struct A {
static void test(const A &) {}
A() {}
private: A(const A &) {}
};
A::test(A());
return 0;
}
main.cpp:10:11: warning: C++98 requires an accessible copy constructor for
class
'A' when binding a reference to a temporary; was private
[-Wbind-to-temporary-copy]
A::test(A());
^
main.cpp:7:14: note: declared private here
private: A(const A &) {}
^
1 warning generated.</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>