[Issue 17694] traits compiles fails for property of property
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Wed Jul 26 05:51:03 PDT 2017
https://issues.dlang.org/show_bug.cgi?id=17694
Steven Schveighoffer <schveiguy at yahoo.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
CC| |schveiguy at yahoo.com
Resolution|--- |INVALID
--- Comment #1 from Steven Schveighoffer <schveiguy at yahoo.com> ---
Actually, the issue is that the thing you are checking isn't valid syntax.
For example:
TBounds.Margins.Left;
Error: need 'this' for 'Margins' of type '@property TBounds()'
What you need is either the typeof, or to use an instance instead of the type
itself:
mixin(`static assert(__traits(compiles, TButton.init.Margins.Left));`);
mixin(`static assert(__traits(compiles, typeof(TButton.Margins.Left)));`);
--
More information about the Digitalmars-d-bugs
mailing list