can not take const struct member address at CTFE , is this a bug?

test123 test123 at gmail.com
Thu Sep 15 04:13:56 UTC 2022


On Wednesday, 14 September 2022 at 14:41:38 UTC, Steven 
Schveighoffer wrote:
> On 9/14/22 12:53 AM, test123 wrote:
>> On Wednesday, 14 September 2022 at 00:40:38 UTC, Ruby The 
>> Roobster wrote:
>>> The addresses of items stored in memory are by definition not 
>>> constant.  This isn't a bug.
>> 
>> If so why this can work ?
>> 
>> ```d
>> struct c { uint a, b;}
>> __gshared const c d = { 3, 4};
>> __gshared const e = & d;
>> ```
>> 
>> the `e` can get address of `d`, then it should be to get 
>> address of `d.a`
>
> Yes, this looks like a bug. Please report if not reported 
> already.
>
> -Steve

Thanks for explain.

Some how I can not create account for d Bugs,  I hope we have use 
github bugs.


Please help me create a bug report if who has free time and bugs 
account.




More information about the Digitalmars-d-learn mailing list