Recursive attribute for virtual functions?

bauss jj_1337 at live.dk
Wed Mar 28 10:07:38 UTC 2018


On Tuesday, 27 March 2018 at 21:02:11 UTC, 12345swordy wrote:
> On Tuesday, 27 March 2018 at 20:49:25 UTC, ag0aep6g wrote:
>> On 03/27/2018 10:39 PM, 12345swordy wrote:
>>> class A
>>> {
>>>      @recursive @safe void talk()
>> [...]
>>> }
>>> class B : A
>>> {
>>>      override void talk() // @safe attribute added by 
>>> recursive attribute and can not be removed
>> [...]
>>> }
>>
>> It already works like that. B.talk is @safe, and you can't 
>> make it @system. You can mark it as @system, that gets 
>> overridden by A.talk's @safe.
>>
>> https://run.dlang.io/is/BlH8bp
> Then explain this then.
> https://run.dlang.io/is/S2KLs5

Your actual test should have been like this:

https://run.dlang.io/is/nF9dQk

And as you can see it gives an error.

You wouldn't be able to do anything that's not safe, so it 
wouldn't really matter.

As soon as you attempted to do something else the compiler would 
yield an error.


More information about the Digitalmars-d mailing list