Possible regression (2.060 -> 2.061) with member access

kenji hara k.hara.pg at gmail.com
Sat Feb 9 07:40:51 PST 2013


2013/2/10 Benjamin Thaut <code at benjamin-thaut.de>

> The following reduced source code would compile just fine with dmd 2.060
> but does no longer compile with dmd 2.061:
>
> file a.d:
> module a;
>
> import b;
>
> template getType(T)
> {
>   alias typeof(T.i) getType;
> }
>
> void main(string[] args)
> {
>   alias getType!Foo t;
> }
>
>
> file b.d:
> module b;
>
> struct Foo
> {
>   private int i;
> }
>
>
> This breaks all kind of low level functionality I did build. It breaks
> both my serialization code and runtime type information system. Because in
> both use cases I need to be able to access the type of a protected or
> private member.
>
> Has this been "fixed" intentionally? Or is this a regression?


It's introduced by fixing issue 5385, so at least not a regression


> If it has been "fixed" what would be a workaround to get the type of Foo.i
> (outside of the b module)
>

You can use built-in 'tupleof' property, which still bypass access
modifier.

Kenji Hara
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20130210/b2f64d5b/attachment-0001.html>


More information about the Digitalmars-d mailing list