|Posted by Elmar|
in reply to Basile B.
Posted in reply to Basile B.
On Sunday, 18 July 2021 at 17:37:52 UTC, Basile B. wrote:
On Saturday, 17 July 2021 at 16:33:54 UTC, Elmar wrote:
Hello D people,
I found a segmentation fault which I can reproduce with
The attack code is simple:
alias getOne = @(0) function int () => 1;
It works without the UDA but segfaults with it. I found it because I wanted to have user-defined attributes to the return values of functions. I can't put the UDA after
function so I put it before.
I believe, this is a forgotton corner case or something because the compiler tells me, UDAs are not allowed in alias definitions.
This is an assertion failure in the parser, reported here.
The code you write should not compile because the FunctionLiteral rule does not include the UserDefinedAttributes one.
Thank you very much for clarification :-) ! I figured out UDAs are supposed to be attached to symbols only and because of compile-time staticness they can only be passed to a function via an alias-parameter but can't be passed to an op-function or constructor unfortunately. The deprecated dual-context makes it harder to pass them to methods and some other functions.
Thank you for adding the report!