[Issue 4993] New: Temporary values and opIndexAssign
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Oct 4 13:15:05 PDT 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4993
Summary: Temporary values and opIndexAssign
Product: D
Version: D2
Platform: Other
OS/Version: Windows
Status: NEW
Keywords: rejects-valid
Severity: major
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: simen.kjaras at gmail.com
--- Comment #0 from Simen Kjaeraas <simen.kjaras at gmail.com> 2010-10-04 13:14:44 PDT ---
The following code does not compile. Note that the exact same functions are
present in both the inner and outer structs, and that opIndex works for both.
struct Foo{
struct Bar {
int opIndex( size_t index ) {
return 3;
}
void opIndexAssign( int value, size_t index ) {
}
}
@property
auto bar( ) {
return Bar( );
}
int opIndex( size_t index ) {
return 3;
}
void opIndexAssign( int value, size_t index ) {
}
}
void main( ) {
Foo f;
f[3] = f[2];
Foo.Bar b;
b[3] = b[2];
f.bar[3] = f.bar[2]; // Fails
}
foo.d(28): Error: f.bar()[3u] is not an lvalue
--
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