<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 --- - Unexpected compilation error with OpenMP: reference to local variable declared in enclosing function"
href="https://llvm.org/bugs/show_bug.cgi?id=28523">28523</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Unexpected compilation error with OpenMP: reference to local variable declared in enclosing function
</td>
</tr>
<tr>
<th>Product</th>
<td>OpenMP
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</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>Clang Compiler Support
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>tiago@skewed.de
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=16730" name="attach_16730" title="Test program that causes the error.">attachment 16730</a> <a href="attachment.cgi?id=16730&action=edit" title="Test program that causes the error.">[details]</a></span>
Test program that causes the error.
The attached test fails with:
$ clang++ --std=gnu++14 -fopenmp clang_test.cc -o clang_test
clang_test.cc:20:23: error: reference to local variable 'x' declared in
enclosing function 'main'
x = y;
^
clang_test.cc:9:9: note: in instantiation of function template specialization
'main()::(anonymous class)::operator()<int>' requested here
f(v[i]);
^
clang_test.cc:16:5: note: in instantiation of function template specialization
'parallel_loop<std::vector<int, std::allocator<int> >, (lambda at
clang_test.cc:17:19)>' requested here
parallel_loop(v,
^
clang_test.cc:15:12: note: 'x' declared here
double x;
^
1 error generated.
GCC compiles this fine, and I don't see why clang shouldn't as well.</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>