<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/63062>63062</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
#pragma clang attribute push does not apply attributes to constructors redeclared with using
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang:frontend,
clang:codegen
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
alanzhao1
</td>
</tr>
</table>
<pre>
Example: https://godbolt.org/z/YEc5bcYd5
```cpp
#pragma clang attribute push(__attribute__((target("ssse3"))), apply_to=function)
struct Base {
__attribute__((always_inline)) Base() {}
};
struct Derived : public Base {
using Base::Base;
};
void foo() {
Derived b;
}
#pragma clang attribute pop
```
This fails to compile because Clang doesn't apply `__attribute__((target("ssse3"))` to `Derived`'s constructor:
```
<source>:7:8: error: always_inline function 'Base' requires target feature 'ssse3', but would be inlined into function 'Derived' that is compiled without support for 'ssse3'
struct Derived : public Base {
^
1 error generated.
Compiler returned: 1
```
Also observe that this applies to other attributes - for example, in the IR for https://godbolt.org/z/on1fqefMb, `__attribute__((cold))` is applied to `Base::Base()`, but not `Derived::Derived()`
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUVMlu4zgQ_RrqUkggUZt90MFLDMxhLoO59MngUpI4oEk1l2TSXz8QJTtO4O5BA4ItFVmvlveqmPdqMIgdqfekPmYshtG6jmlmfozMFhm38r17-ZddJo2k3MEYwuRJuSP0ROhpsJJbHZ6tGwg9_SD09O1F1Fx8kzXJjyTfrb9NvjximlYLLSfHhgsDoZkZgIXgFI8BYYp-JHRzPt9M5zOhG0I3gbkBQ3qn3nssCaWEbq_PAdg06fdzsKQ89tGIoKyZT-4S8cFFEWDPPAJp94sRAOBBOKbf2Ls_K6OVwSVIckyn2-TeHlfw9kjK_YNAR3TqFSXMnZsi10o8iB29MsMCXe5IuVve9j-DfrVKQm_tXR43qGs8_sn_nomf991OX8i69_t7VB56prSHYEHYy6Q0AkfBokc4JCxp0RtC27AQAaTJf4_FJp_BSZOvZcw50NaDsGbpp3Vzhx5mWR68jU4gKV9IuWtJudvMTUfnkhN8YhOu8gBC24XTFhx-j8qhhyVD6JGF6HC-subZziLjMcCbjVoCR1jgJCgT7CfQawW0hTCyAMpfmybhTYXRxgA-TpN1AXrrPgX5bQEBAKlflu9iKRkGNOhYQPm82A9LdAcOQ3QG5YxY_ILxnfYWLPfoXnGpIcwamKlVmFRgw4juQ0EenlIpuC4LegBlIIwIf_yVDv5vdVhT9N-x_5PPro_FI6yWH2K5pSNX3XyZoTQgSUQLbcaGe3Wlizei1ruZ7Eq5Lbcsw65oNnVTVXlTZ2PHGlFRnve8YBWrRJVvOS8Ea0XJirZiTaY6mtMyb_Ki2NC2qp7rmlZ9yfui7zGXsiFVjhem9LPWr5e57kx5H7FryryhmWYctU97mNI0nKTc9c6agEamGTncHQgrcUAz2-tj5roZ8onHwZMq18oH_xEkqKCx-_XCTbOb-rOM7h2padxv8-fBoUShmVuFvGyvLDrdfeFXhTHyZ2EvhJ7mZNa_p8nZf1AEQk-pfE_oKXXgvwAAAP__--sDKA">