<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 - User-defined float literal broken with device nvptx64-nvidia-"
href="https://bugs.llvm.org/show_bug.cgi?id=48070">48070</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>User-defined float literal broken with device nvptx64-nvidia-
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>11.0
</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>OpenMP
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>gcc.j.kelling@hzdr.de
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=24132" name="attach_24132" title="minimal reproducer">attachment 24132</a> <a href="attachment.cgi?id=24132&action=edit" title="minimal reproducer">[details]</a></span>
minimal reproducer
The attached example, defining a user-defined float literal type and using it
in an OpenMP target region is valid and compiles for x86_64, using
```
clang++ -fopenmp -fopenmp=libomp -fopenmp-targets=x86_64-pc-linux-gnu
literal.cpp
```
It does does not compile with
```
clang++ -fopenmp -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda
literal.cpp
```
failing with the message:
```
../literal/literal.cpp:14:11: error: 'operator""_X' requires 128 bit size 'long
double' type support, but device 'nvptx64-nvidia-cuda' does not support it
a += 1._X;
^
../literal/literal.cpp:1:18: note: 'operator""_X' defined here
constexpr double operator"" _X (long double a)
^
```
Expected behavior: The long double argument type of the literal operator is a
literal and does live at runtime, only the return value enters runtime as a
constant, thus device support for long double by the target architecture is not
needed.
Also note, that such literals for floats can only be defined using long double,
raising the following error when, e.g., using double instead:
```
literal.cpp:1:33: error: invalid literal operator parameter type 'double', did
you mean 'long double'?
constexpr double operator"" _X (double a)
^~~~~~~~
```
Thus, allowing target architecture restriction enter compile time here, would
make support for user-defined literals in target regions impossible.</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>