April 03, 2009 [Issue 2788] New: return val not passable via ref const in other method | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=2788 Summary: return val not passable via ref const in other method Product: D Version: 2.027 Platform: PC OS/Version: Windows Status: NEW Keywords: rejects-valid Severity: normal Priority: P2 Component: DMD AssignedTo: bugzilla@digitalmars.com ReportedBy: spam@extrawurst.org This used work perfectly fine, why not anymore ? (since 2.027) [CODE] int getVar() { return 2; } void foo(ref const int _p) {} void main() { foo(getVar()); } [/CODE] Error: function main.foo (ref const const(int) _p) does not match parameter types (int) Error: getVar() is not an lvalue -- |
March 01, 2011 [Issue 2788] return val not passable via ref const in other method | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2788 Trass3r <mrmocool@gmx.de> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |mrmocool@gmx.de Platform|x86 |All OS/Version|Windows |All --- Comment #1 from Trass3r <mrmocool@gmx.de> 2011-03-01 06:28:43 PST --- ref const doesn't make any sense with basic types. But it makes sense for struct and static array temporaries. The weird thing is struct literals count as lvalues in D2, so this works: struct A {} void foo(ref A a) {} void main() { foo(A()); } while calling the following doesn't: static A bar() { return A(); } foo(bar()); -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation