<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/56697>56697</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Compatibility problem of clang and NVCC in ‘auto’ type deduction
</td>
</tr>
<tr>
<th>Labels</th>
<td>
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
objwyhx
</td>
</tr>
</table>
<pre>
`
#define foo_device __attribute__((device))
#define foo_host __attribute__((host))
typedef unsigned long size_t;
extern foo_host int foo(void **devPtr, size_t size);
template <typename T>
static foo_device int foo(T **devPtr, size_t size);
template<class T>
static foo_host int foo(T **devPtr, size_t size) {
return ::foo((void**)(void*)devPtr, size);
}
int main() {
auto fp = &foo<double>;
return 0;
}
`
nvcc accept this code but clang doesn't accept it.
https://godbolt.org/z/3vdq3KvEP
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJydU01v2zAM_TXyRVigWLEdH3xIk_QyYOih2DWQJTpWoVieRWdNf_0oJ0GatkCBGfQHTfG9R4qqvTlVLBdMbJhYsVQaaGwHvPF-Z-BoNfDdTiEOth4RdjuWLsnOEZaW0b7IbH3Ar_Li_7us6YmnHiiZj12w-w4Md77b82DfYIdMPrxfCq8IQ3fjsB1Gh6CP3hrOUhKyInVPOLB0fcGYXpHzHgvh0DuFwJlcRwmdOgB_ZnLLz_GACq1-34kb2_P_URGTdiqEieYTy4eKvuPgrLiQcLoGwJE6w-SK7Axw6coZZWr7zS_vUe8kF5v32qOgg7LdBPiBVI3oedMT64bE5pFWro0fawexQPlZn_iC5jp93VFrrrSGHjm2NnDtDXCaH05No4kwHgLJKPC6yOLsnNki9iGWnj6S7b2pvcOZH_bkvdEtj-aP_HncPiVQzfNsWaSlKMrEVNKUslQJWnRQrf2hp82orbN44v3gqYwD982FXnWG__q9XtMWcbZN2VKwchk7cHVKHseIGzCjRuu7ZBxc9UGaxXasZ9ofyHHueH39ILYX0HQ4Hm0IIwT6yPK8LJK2qnNhMgOZXGZSpLWCxuhcQKEXxaIsFyZxqgYXKpY9sGyT2CoVaSqKNBO5WMhiJsusMXUzV1rMF3UxZwsBtKFuFoljk5KhmjTU4z5Q0NmA4RakcY2nEq74VHHrh8rXL39P7Wsyya0mrf8Av05PLg">