[Issue 8161] -property should give an error for invalid property functions

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Sep 28 18:52:56 UTC 2017


https://issues.dlang.org/show_bug.cgi?id=8161

bitwise <nicolas.jinchereau at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |nicolas.jinchereau at gmail.co
                   |                            |m

--- Comment #4 from bitwise <nicolas.jinchereau at gmail.com> ---
(In reply to Jonathan M Davis from comment #0)

> struct S
> {
>     @property void prop(int a, int b)
>     {
>     }
> }
> 
> It can't possibly be used as a property function either. I'd argue that any
> such function should be considered an error as long as it's marked as
> @property and the -property flag is used.

This works:

struct S {
    @property void prop(int a, int b){}
}

int main(string[] argv) {
    S s;
    s.prop = AliasSeq!(1, 2);
    return 0;
}

This behavior is not obvious though, and I agree that it should be disallowed.

--


More information about the Digitalmars-d-bugs mailing list