<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 --- - [OPENMP] canonical loop rejected when comparison has implicit conversions or destruction" href="https://urldefense.proofpoint.com/v2/url?u=https-3A__llvm.org_bugs_show-5Fbug.cgi-3Fid-3D24121&d=AwMBaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=pF93YEPyB-J_PERP4DUZOJDzFVX5ZQ57vQk33wu0vio&m=F9jxFxIRJXYlurRrwsbWwrhA1p-VO9y523dxYppeRX4&s=K0ApFvbtG5b2MHmh6Yqxq72XiOjxtHJke8uio6ZFs6I&e=">24121</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[OPENMP] canonical loop rejected when comparison has implicit conversions or destruction
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </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>C++
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>hstong@ca.ibm.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>Created <span class=""><a href="attachment.cgi?id=14587" name="attach_14587" title="Test canonical loop with custom random access iterators">attachment 14587</a> <a href="attachment.cgi?id=14587&action=edit" title="Test canonical loop with custom random access iterators">[details]</a></span>
Test canonical loop with custom random access iterators

When a user-defined random access iterator is used with the OpenMP loop
construct, Clang rejects canonical loops if the comparison operation entails
implicit conversions or the creation of temporaries requiring non-trivial
destruction.

Source is attached; various cases are included under macro control.

CASE_0: this works; it includes an namespace operator< for the iterator type
CASE_1: this fails; calling the same operator< now involves non-trivial temp
destruction
CASE_2: this fails; the operator< returns a class object which is contextually
convertible to bool
CASE_3: this fails; a built-in operator< is used, requiring implicit conversion
of the operands


### COMPILER INVOCATION:
clang++ -fopenmp=libomp -std=c++11 openmpCmpOp.cc -DCASE_0 -c
clang++ -fopenmp=libomp -std=c++11 openmpCmpOp.cc -DCASE_1 -c
clang++ -fopenmp=libomp -std=c++11 openmpCmpOp.cc -DCASE_2 -c
clang++ -fopenmp=libomp -std=c++11 openmpCmpOp.cc -DCASE_3 -c


### OUTPUT (failing cases):
openmpCmpOp.cc:62:29: error: condition of OpenMP for loop must be a relational
comparison ('<', '<=', '>', or '>=') of loop variable 'it'
  for (It<char> it = begin; it < end; ++it) {
                            ^~~~~~~~
1 error generated.


### EXPECTED OUTPUT:
(Compiles successfully).


### COMPILER VERSION INFO:
clang version 3.7.0 (trunk)
Target: powerpc64le-unknown-linux-gnu
Thread model: posix
Found candidate GCC installation: /usr/lib/gcc/ppc64le-redhat-linux/4.8.2
Found candidate GCC installation: /usr/lib/gcc/ppc64le-redhat-linux/4.8.3
Selected GCC installation: /usr/lib/gcc/ppc64le-redhat-linux/4.8.3
Candidate multilib: .;@m64
Selected multilib: .;@m64</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>