<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 - Device friend function is not seen in different file"
href="https://bugs.llvm.org/show_bug.cgi?id=45982">45982</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Device friend function is not seen in different file
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>10.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>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>CUDA
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>nikolay_nechaev@mail.ru
</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=23505" name="attach_23505" title="The archive containing files being compiled">attachment 23505</a> <a href="attachment.cgi?id=23505&action=edit" title="The archive containing files being compiled">[details]</a></span>
The archive containing files being compiled
I figure out it's a bug because `nvcc` compiles this without issues, but
`clang` gives a compilation error
I have got the `MyClass` class described at MyClass.cu, MyClass.cuh files.
There is a friend function declared in .cuh and defined in .cu file. The header
is included to main.cu, the project is compiled with both cu files.
Compilation commands are `nvcc main.cu MyClass.cu` and `clang++-10
--cuda-gpu-arch=sm_30 -L/usr/local/cuda/lib64 -lcudart_static -ldl -lrt
-pthread main.cu MyClass.cu`
Expected behaviour (like `nvcc`)
No output is produced, an executable is created
Actual behaviour (`clang`'s)
Getting compilation error:
```
main.cu:8:5: error: use of undeclared identifier 'init'
init<<<1, 1>>>(&obj);
^
1 error generated when compiling for sm_30.
```</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>