http://d.puremagic.com/issues/show_bug.cgi?id=8915
Summary: Current lvalue behavior looks inconsistent for structs
and buildin types
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: P2
Component: DMD
AssignedTo: [email protected]
ReportedBy: [email protected]
--- Comment #0 from Denis Shelomovskij <[email protected]> 2012-10-30
18:30:09 MSK ---
---
int iFunc() { return 0; };
enum int iEnum = iFunc();
struct S { }
S sFunc() { return S(); };
enum S sEnum = sFunc();
void refI(ref int) { }
void refS(ref S) { }
void main()
{
refI(int.init); // Error: constant 0 is not an lvalue
refI(iEnum); // Error: constant 0 is not an lvalue
refI(iFunc()); // Error: iFunc() is not an lvalue
refS(S()); // compiles
refS(S.init); // compiles
refS(sFunc()); // Error: f() is not an lvalue
refS(sEnum); // compiles
}
---
This leads to inability to define `NonZeroUInt32` struct e.g. with same
semantics as `uint`.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------