<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/118415>118415</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [CUDA] Clang does not diagnose invalid call to a host function from device.
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            cuda
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
            Artem-B
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          Artem-B
      </td>
    </tr>
</table>

<pre>
    https://godbolt.org/z/Gseb9zjqq

```
__host__ int host_func();
struct A {
  A(int);
};
struct B : A {
 __attribute__((host)) __attribute__((device)) B()
      : A(host_func()) {}
};

struct C {
  B alloc;
};

__attribute__((global)) void DeviceScanKernel() {
  C c;
}
```

This results in ptxas failing due to an unresolved reference to the `host_func`

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxsU81unDAQfprhMsrKNrDAgQO7K3rose0ZGTyAI6-d2GbV5ukrCMpu0iJLDMzw_Yw-ZAh6skQ15CcQovGRrk9rBfklkUucna_3l0nv1J96jvElQNqAaEG0k1O9M_Hg_ASifQPRfgvUV2_Pr6_AmvUc2X5Y03WzC7HrUNuIWzkudgBRgqggPQFrQvTLELFBKNZHxAZEqW38GIDi8mnyhJA29_mukzF63S-Rum4DLlee9XNR_a-r6KYH2vunXcpKvF4b9A7xKFVUG19xeRR013T-UH9CaYwbvkjfNvGPksm4Xpod_ua0wsum7ccg7Xfylsw7-wf4GR-APy8aWPNz1gE9hcXEgNriS_wtA45SG20nVAthdCgtLtZTcOZGCj2N5MkOWyvOhHBkd-sbcKLqVFVpJROqeZGmvOJ5yZO5znlVjnmfiYznIqdspJGlOWf8yHMqc5HoWjCRccFSJthRsIPMC6KiKkaVlVJJDhmjq9TmYMztuuYp0SEsVHNeZjxPjOzJhD2lw6LkHlFfr_NP_TIFyJjRIYY7QtTRbMk-_7o0kF_wbOTq3lFA6yIqLSfrAqG2N2m0wkEasy1miyeuxqN2FkfvrvielUOyePP1L9BxXvrD4K4g2pV9vz29ePdMQwTRbmYCiHb3c6vF3wAAAP__rXIKCw">