[llvm-bugs] [Bug 51327] New: Range based for loop not working if range's type is a template.
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue Aug 3 08:11:40 PDT 2021
https://bugs.llvm.org/show_bug.cgi?id=51327
Bug ID: 51327
Summary: Range based for loop not working if range's type is a
template.
Product: OpenMP
Version: unspecified
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Clang Compiler Support
Assignee: unassignedclangbugs at nondot.org
Reporter: northon_patrick3 at yahoo.ca
CC: llvm-bugs at lists.llvm.org
Example:
void do_loop(const auto &v)
{
#pragma omp parallel for
for(const auto &i : v){
std::cout << i << '\n';
}
}
Result in error:
error: initialization clause of OpenMP for loop is not in canonical form ('var
= init' or 'T var = init')
for(const auto &i : v){
^
Change `const auto &v` to say, `const std::vector<int> &v` and it work. I don't
know what the standard say about this case but it work under gcc and it would
also be very useful.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210803/96d002d5/attachment.html>
More information about the llvm-bugs
mailing list