[Issue 11258] Static field access problem

2013-10-14 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=11258



--- Comment #1 from Kenji Hara k.hara...@gmail.com 2013-10-14 06:45:10 PDT ---
(In reply to comment #0)
 In dmd 2.063 this used to work.

This is a regression from 2.062, and same error occurs with 2.063.

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


[Issue 11258] Static field access problem

2013-10-14 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=11258


Kenji Hara k.hara...@gmail.com changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||INVALID


--- Comment #2 from Kenji Hara k.hara...@gmail.com 2013-10-14 07:26:07 PDT ---
(In reply to comment #1)
 (In reply to comment #0)
  In dmd 2.063 this used to work.
 
 This is a regression from 2.062, and same error occurs with 2.063.

Sorry, this is NOT a regression. Current behavior is intended.

In class/struct DeclDefs scope, directly using function literal is not allowed.

struct Bar {
int var;
auto dg = { return var; };
// Error: function literals cannot be class members
}

Against that, __traits(compiles) has *no* special handling. Therefore,

struct Bar {
int var;
static assert(__traits(compiles, { return var; }));
// catch cannot be class members error, then returns false
}

The static assert correctly fails. Therefor current behavior is intended.

On the other hand, this error check is stopped inside typeof operator. It's
also an intended behavior.

So, in this case, please use is(typeof({ ... })) instead.



Note: The old bug, existed in 2.062 and earlier, was fixed in here:
https://github.com/D-Programming-Language/dmd/commit/0679c4c31ba78853873933324c69cd90e7714d15#diff-ffa5582af7d723c487d4a11ac6743b85R84

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


[Issue 11258] Static field access problem

2013-10-14 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=11258



--- Comment #3 from bearophile_h...@eml.cc 2013-10-14 09:42:37 PDT ---
(In reply to comment #2)

 Sorry, this is NOT a regression. Current behavior is intended.

Thank you Kenji, this was tricky for me.


Regarding the extra newlines in the error message:


test.d(5): Error: static assert  (__traits(compiles, ()

{

auto x = Foo.spam;

}

)) is false


Do you want me to open another minor importance bug report on it?

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


[Issue 11258] Static field access problem

2013-10-14 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=11258



--- Comment #4 from Kenji Hara k.hara...@gmail.com 2013-10-14 10:11:39 PDT ---
(In reply to comment #3)
 Regarding the extra newlines in the error message:
 
 
 test.d(5): Error: static assert  (__traits(compiles, ()
 
 {
 
 auto x = Foo.spam;
 
 }
 
 )) is false
 
 
 Do you want me to open another minor importance bug report on it?

I hope you that.
And I'd ask you one question: If the lambda has quite big body, how it will be
output?

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


[Issue 11258] Static field access problem

2013-10-14 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=11258



--- Comment #5 from bearophile_h...@eml.cc 2013-10-14 15:05:50 PDT ---
(In reply to comment #4)

 I hope you that.
 And I'd ask you one question: If the lambda has quite big body, how it will be
 output?

OK, I have opened Issue 11263 .

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