On 07/26/2018 09:24 AM, jmh530 wrote:
> On Thursday, 26 July 2018 at 08:08:17 UTC, Timoses wrote:
>> On Wednesday, 25 July 2018 at 21:17:38 UTC, jmh530 wrote:

>> 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 doesn't but the scope itself is legal in a nested scope; so, 'const' should not remove the scope either.

> It works at the
> global level just fine.

It must be because one cannot introduce a nested scope at the global scope:

// illegal
{
    double bar;
}

void main() {
    // legal
    {
        double bar;
    }
}

Ali

Reply via email to