<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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 offload option and complex header affects type promotion"
   href="https://bugs.llvm.org/show_bug.cgi?id=47655">47655</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>openmp offload option and complex header affects type promotion
          </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>enhancement
          </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>xw111luoye@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Since 56069b5c71ca78749aa983c1e9de6f1e4c049f4b
The reproducer

#include <cmath>
#include <complex>
#include <iostream>

int main()
{
  std::cout << "sqrt(2.0f) = " << std::sqrt(2.0) << std::endl;
  std::cout << "sqrt(2.0) = " << std::sqrt(2.0f) << std::endl;
  std::cout << "sqrt(2) = " << std::sqrt(2) << std::endl;
}

works fine with
$ clang++ minimal.cpp

but not
$ clang++ -fopenmp -fopenmp-targets=nvptx64 minimal.cpp 
clang-12: warning: Unknown CUDA version 11.0. Assuming the latest supported
version 10.1 [-Wunknown-cuda-version]
In file included from minimal.cpp:2:
In file included from
/home/packages/llvm/master-20200923/lib/clang/12.0.0/include/openmp_wrappers/complex:44:
/home/packages/llvm/master-20200923/lib/clang/12.0.0/include/openmp_wrappers/complex_cmath.h:132:10:
error: no matching function for call to 'polar'
  return polar(sqrt(abs(__x)), arg(__x) / _Tp(2));
         ^~~~~
/usr/lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/cmath:475:5: note: in
instantiation of function template specialization
'std::sqrt[device={arch(nvptx, nvptx64)}, implementation={extension(match_any,
allow_templates)}]<int>' requested here
    sqrt(_Tp __x)
    ^
minimal.cpp:9:32: note: in instantiation of function template specialization
'std::sqrt<int>' requested here
  std::cout << "sqrt(2) = " << std::sqrt(2) << std::endl;
                               ^
/usr/lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/complex:694:5: note:
candidate template ignored: deduced conflicting types for parameter '_Tp'
('double' vs. 'int')
    polar(const _Tp& __rho, const _Tp& __theta)</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>