hasUDA with this

jmh530 john.michael.hall at gmail.com
Thu Jul 26 16:24:17 UTC 2018


On Thursday, 26 July 2018 at 08:08:17 UTC, Timoses wrote:
> On Wednesday, 25 July 2018 at 21:17:38 UTC, jmh530 wrote:
>> On Friday, 20 July 2018 at 18:24:11 UTC, Timoses wrote:
> (snip)
> I don't think that bug report relates to the initial question 
> (UDA not applying to run-time instance).
>

True. But I was thinking about making a block that applies the 
UDA to everything within the block as a way to avoid the problem 
of copying the UDA to another variable.

>
> Regarding this example
>
> void fun() {
>     /*const*/
>     {
>         double bar;
>     }
>
>     static assert(!is (typeof(bar)));
> }
>
> it would kind of violate that `bar` is declared within its own 
> scoped block if the static assert failed just because `const` 
> was applied to the block.

I don’t think the const block introduces a new scope. It works at 
the global level just fine. Public/private/etc are also a 
relevant example.




More information about the Digitalmars-d-learn mailing list