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

    <tr>
        <th>Summary</th>
        <td>
            error: use of undeclared identifier 'noinline';  clang CUDA 
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          burlen
      </td>
    </tr>
</table>

<pre>
    When I use clang to compiled CUDA code which uses `std::shared_ptr` in the API  I have the following error:
```
$ clang++ -x cuda --cuda-gpu-arch=sm_75  test_main.cpp
clang++: warning: CUDA version is newer than the latest partially supported version 11.8 [-Wunknown-cuda-version]
In file included from test_main.cpp:2:
In file included from /usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/memory:77:
In file included from /usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/shared_ptr.h:53:
/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/shared_ptr_base.h:196:22: error: use of undeclared identifier 'noinline'; did you mean 'inline'?
 __attribute__((__noinline__))
 ^
/usr/local/cuda-12.0/include/crt/host_defines.h:83:24: note: expanded from macro '__noinline__'
        __attribute__((noinline))
 ^
In file included from test_main.cpp:2:
In file included from /usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/memory:77:
In file included from /usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/shared_ptr.h:53:
/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/shared_ptr_base.h:196:22: error: type name does not allow function specifier to be specified
/usr/local/cuda-12.0/include/crt/host_defines.h:83:24: note: expanded from macro '__noinline__'
        __attribute__((noinline))
 ^
In file included from test_main.cpp:2:
In file included from /usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/memory:77:
In file included from /usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/shared_ptr.h:53:
/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/shared_ptr_base.h:196:22: error: expected expression
/usr/local/cuda-12.0/include/crt/host_defines.h:83:33: note: expanded from macro '__noinline__'
        __attribute__((noinline))
 ^
3 errors generated when compiling for sm_75.
```
A much simplified reproducer is
```C++
#include <memory>
int main(int, char**)
{
    std::shared_ptr<double> pd = nullptr;
    return 0;
}
```
I suppose this may be an issue in CUDA headers themselves, but this is only happens when compiling with Clang, NVIDIA's compilers do not have the problem. 
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzsV0-Po7gT_TTOpRRE7ADhkAOdTKRcfvpddueIjF0J3jU28p9O59uvDHR6pjen1Wp2tZoIhYBdznvFq-KZe6-uBnFPihdSHFc8ht66fRedRrPqrLzvv_Zo4AzRIwjNzRWCBWGHUWmUcPjl2ICwEuHWK9GnWR5ImfsgCWsIa3zPHcp2DI6UOSgDoUdo_n8GOEPPX3G6vlit7U2ZK6Bz1qXI_EjyhpT5csyXdDtDIPSF0BdYv4GIksN6nU7r6xjX3ImesKMf2qoACOhDO3BlMjGO8xrfxBPWwI07o8w1_ZyovKLzyhpQHgze0EHo-YxZ87QajNwFxbW-g4_jaF1A-QjabLIdkOJl_TWa3429mRnXMkyK4wzhbOCiNIIyQkeJEi7ODp-wsoY-svB8PqGn6B2hJ606Qk9XIQg9ve3KttyuHcqeh7VWJr4RetpQQk9Z9uevZUVCT2JJyTJ5wMG6O2FNVf2TMDoVPKGnDw1lPWFNwT4E8kP_ve24xwnCpi7TI0rP6CHZqULsBaKRKHSKASXRBHVR6IDQylhltDJIaEXYC0gl4W4jDMhNGv5m8DSzg7blITjVxYBtS-iO0F3bvi-T7tTpmOeS4svnnFjBdaKVRLihWf49WRcIPfXWh1biRRn0E7NdSi7dJj7GBpwIvo3cPB74wIWzCe_3SKoFxvJ5gvyD_jPUP4viv1kU4T4iGD4gSIs-aQp4avZwiUaE1DX9iGKukWChw8e1_Cnnn3L-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