[llvm-bugs] [Bug 48697] New: Clang fails to compile OpenMP code using iterators to iterate through a loop on C++20

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Jan 8 00:12:37 PST 2021


https://bugs.llvm.org/show_bug.cgi?id=48697

            Bug ID: 48697
           Summary: Clang fails to compile OpenMP code using iterators to
                    iterate through a loop on C++20
           Product: OpenMP
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Clang Compiler Support
          Assignee: unassignedclangbugs at nondot.org
          Reporter: tbsteinb at live.com
                CC: llvm-bugs at lists.llvm.org

Created attachment 24366
  --> https://bugs.llvm.org/attachment.cgi?id=24366&action=edit
A sample piece of source code which triggers the bug

When compiling code which uses OpenMP to parallelize a for loop using
iterators, and compiling with `-std=c++20`, compilation fails with the
following error:

error: condition of OpenMP for loop must be a relational comparison ('<', '<=',
'>', '>=', or '!=') of loop variable 'v'
        for(auto v = vec.begin(); v < vec.end(); ++v) {

Steps to reproduce:
1) Write some code which uses OpenMP to parallelize a for loop using iterators
(I attached a file which does this).
2) Compile the code in Clang with the flags `-fopenmp -std=c++20`.

Actual behavior:
The code fails to compile giving the error listed above.

Expected behavior:
The code should successfully compile.

Date and Build:
I first saw this bug in July of 2020. I only tracked it down to using C++20 as
of January 2021 though.

Additional Information:
I've seen this error on Clang 10, 11, and on trunk (I have not tested anything
earlier than 10).
I have seen this bug on multiple Linux distros, but have not tested it on other
operating systems.
The bug only occurs if you use iterators for the for loop, indices work as
expected.

-- 
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/20210108/110850ce/attachment.html>


More information about the llvm-bugs mailing list