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

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue May 29 23:22:24 PDT 2012


http://d.puremagic.com/issues/show_bug.cgi?id=8161



--- Comment #1 from Kenji Hara <k.hara.pg at gmail.com> 2012-05-29 23:24:13 PDT ---
(In reply to comment #0)
> This code compiles with -property:
> 
> struct S
> {
>     @property void prop()
>     {
>     }
> }
> 
> void main()
> {
> }
> 
> 
> It makes no sense that it would.

I can agree.

> Another example would be a function like
> 
> 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.

A @property function has two parameters is now allowed for UFCS property
setter.

@property foo(T)(T obj, int val) { ... }
void main() {
   S s;
   s.foo = 1;  // translated to .foo(s, 1), it's valid.
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list