Bug 8915 – Current lvalue behavior looks inconsistent for structs and buildin types

Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-10-30T08:30:00Z
Last change time
2014-09-14T14:06:24Z
Assigned to
nobody
Creator
verylonglogin.reg

Comments

Comment #0 by verylonglogin.reg — 2012-10-30T08:30:09Z
--- 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`.
Comment #1 by yebblies — 2013-11-23T21:06:51Z
Now all give errors.
Comment #2 by k.hara.pg — 2014-09-14T14:06:24Z
*** This issue has been marked as a duplicate of issue 9069 ***