D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 2852 - Cannot pass temporary result by reference (regression)
Summary: Cannot pass temporary result by reference (regression)
Status: RESOLVED DUPLICATE of issue 3167
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86 Windows
: P2 regression
Assignee: No Owner
URL:
Keywords: rejects-valid
Depends on:
Blocks:
 
Reported: 2009-04-18 07:11 UTC by Koroskin Denis
Modified: 2015-06-09 01:18 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Koroskin Denis 2009-04-18 07:11:51 UTC
Test code:

struct Rect
{
    int x,y,w,h;
}

void pass(ref Rect rect)
{
}

Rect get()
{
    return Rect();
}

void main()
{
    pass(get);
}

Note that this is a regression since DMD2.025
Comment 1 Koroskin Denis 2009-04-18 07:25:13 UTC
Compiler output (dmd2.028):
test.d(17): Error: function test.pass (ref Rect rect) does not match parameter types (Rect)
test.d(17): Error: get() is not an lvalue
Comment 2 Gide Nwawudu 2009-04-19 07:11:52 UTC
Looks like a deliberate change, see BUG 2621.
Comment 3 Don 2009-10-15 05:25:26 UTC
This is the same as bug 3167. Although this report is older, it's the later one 
which Walter commented on. So I'm closing this one.
Comment 4 Don 2009-10-15 05:27:05 UTC

*** This issue has been marked as a duplicate of issue 3167 ***