<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 --- - The code using blocks and modifier __block that compiles successfully in clang from XCode 5.0, but fails in previous."
href="http://llvm.org/bugs/show_bug.cgi?id=17597">17597</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>The code using blocks and modifier __block that compiles successfully in clang from XCode 5.0, but fails in previous.
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>Macintosh
</td>
</tr>
<tr>
<th>OS</th>
<td>MacOS X
</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>-New Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>konevaanna2012@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Dear Sirs!
I am Anna Koneva, a software developer from Moscow, Russia.
Below is the code, where we try to use a variable declared outside the block of
type std::ifstream inside the block.
__block std::ifstream file("/tmp/bar") ;
// We’ll try with and without a qualifier __block
void (^block)() = ^{
file.rdbuf();
file.close();
file.open("/tmp/bar");
};
block();
1. If we declare the variable with the qualifier __block, we’ll get the
following error message (Clang, XCode 4.2):
«main.mm:28:27: Call to implicitly-deleted copy constructor of 'std::ifstream'
(aka 'basic_ifstream<char>')»
BUT! On the latest clang (XCode 5.0) we do not get an error message and this
code compiles successfully.
By the way...
2. If without this modifier (__block), then the other error occurs:
«main.mm:31:9: Call to implicitly-deleted copy constructor of 'const
std::ifstream' (aka 'const basic_ifstream<char>')
main.mm:32:9: Member function 'close' not viable: 'this' argument has type
'const std::ifstream' (aka 'const basic_ifstream<char>'), but function is not
marked const»
This behavior is the same for both clang (XCode 4.6.2 and new XCode 5.0).
So please tell me, is it a correct behavior for the first case in XCode 5.0?
Best regards,
Anna.</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>