<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/63443>63443</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
`offsetof()` doesn't support `::` in member names
</td>
</tr>
<tr>
<th>Labels</th>
<td>
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
HolyBlackCat
</td>
</tr>
</table>
<pre>
I'm not sure what the standard has to say about it, but GCC and MSVC accept it, and it can be a useful feature.
E.g. GCC and MSVC accept following code:
```cpp
#include <cstddef>
#include <iostream>
struct Empty {};
#define FOO [[no_unique_address]] Empty e;
struct A
{
FOO int x;
};
struct B
{
FOO int y;
};
struct C : A, B
{
FOO int z;
};
template <typename D, typename B>
constexpr std::size_t base_offset = offsetof(D, B::e);
int main()
{
std::cout << base_offset<C, A> << '\n'; // 0
std::cout << base_offset<C, B> << '\n'; // 4
std::cout << base_offset<C, C> << '\n'; // 8
}
```
While Clang trunk says:
```none
<source>:24:50: error: expected ')'
24 | constexpr std::size_t base_offset = offsetof(D, B::e);
| ^
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJysVM1u4zYQfprRZbCGTMqWfNDBkuO2h2IPBdpjQJEjm12JVMlRN96nL6jYSZosEiywhkFSnJlvvvmjitGeHFENmwY2h0zNfPah_tUPl2ZQ-kurOOu8udS_gShHdJ4xzoHw61kx8pkwsnJGBYNnFZE9RnVB1fmZ0TKIFruZ8Ze2ReUM_v7Hny0qrWm6SdOtZdTKYUeocI7UzwP2pHgOtIL8APn-cb1bnVbfRer9MPiv1p1Qe0Mgr_qwzR__epquN0Jap4fZEIJsdWRjqAd59z2p9ZEDqfFZvKyRw6wZ78aJLwhlA-UBZPNSA4Q01FtHePz8GZesNs7fz87-M9O9MiZQjLA5wOZwhaFXCFcfN7zyKkTEBdI6xodnkzcErubNO-aXj81bBLnHfarRe0jf3kFiGqdB8ZJOvkzk1Eh4SIhPX81TerV3kelhChjZpBrKfbTf6J6xU5Hufd9HYgR5wMej70FUh0d6izaB2L0ikAiOyjoQVRK-jeLJlU79CrIF2b70B7Jtk4s9yLubGEQJm9alTTYI4gjiiPmPYzYfYRY_jtl-hFk91-r_M_IybX-d7UDYDsqdkMPsvqSZjm_nynlH1yvZRj8HTamcci8KkPtNnhqIQvBhOTxMpJnMwkvs0noLTxQIZYs_twNw-SVc2Ny9Ip6ZWpqd3KmM6vW2KmVV7fJ1dq53fbk2quhLkXdFWZVCk1KV2HQ7oWW_1pmtRS5kvhVrIfNKrFddnq_Xldam07ttRxqKnEZlh9Uw_DuufDhlNsaZ6q0sCpkNqqMh3p7aUCelT918ilDkg40cn83Y8kA1bPMXwab4tjkaTzHVNb3E0-QDYwprSUESW4cjjR0FTCMWszkM9Zl5Wiq4tMHJ8nnuVtqPII7J43X7NAX_N2kGcVxYRxDHhfh_AQAA___eWrhV">