[Issue 9062] AddrExp should distinguish the existence of property resolution.

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Nov 23 06:06:48 PST 2012


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



--- Comment #9 from Kenji Hara <k.hara.pg at gmail.com> 2012-11-23 06:06:46 PST ---
(In reply to comment #8)
[snip]

OK, I understood what you say. But implementing it in library might be much
difficult...

---
// An experimental implementation of timon's idea.
template PropertyTypeOf(alias prop)
{
    auto ref wrapper()(){ return prop(); }
    alias PropertyTypeOf = typeof(&wrapper!());
}

/*@property*/ int foo() @trusted nothrow { return 10;}
pragma(msg, PropertyTypeOf!foo);
// -> int function() nothrow @safe  (not @trusted)

void main()
{
    struct S { /*@property*/ string bar() pure { return ""; } }
    pragma(msg, PropertyTypeOf!(S.bar));
    // -> Error...
}
---

-- 
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