[dmd-beta] rvalue references

Jonathan M Davis jmdavisProg at gmx.com
Thu Apr 12 10:14:02 PDT 2012


On Thursday, April 12, 2012 18:53:41 Andrej Mitrovic wrote:
> On 4/12/12, Max Samukha <maxsamukha at gmail.com> wrote:
> > I think the language should allow taking addresses of references in unsafe
> > context. One valid and fairly frequent case is passing the address to C:
> > 
> > extern(C) external_foo(S* s);
> > 
> > void foo(ref S s)
> > {
> > 
> > external_foo(&s);
> > 
> > }
> 
> FWIW You can actually use 'ref' in an extern(C) function:
> extern(C) external_foo(ref S s);
> 
> wxD uses it.

Which I would have expected to be illegal, but for some bizarre reason, the 
compiler allows it.

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

- Jonathan M Davis


More information about the dmd-beta mailing list