[Issue 8915] New: Current lvalue behavior looks inconsistent for structs and buildin types
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Oct 30 08:30:13 PDT 2012
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: nobody at puremagic.com
ReportedBy: verylonglogin.reg at gmail.com
--- Comment #0 from Denis Shelomovskij <verylonglogin.reg at gmail.com> 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: -------
More information about the Digitalmars-d-bugs
mailing list