Bug 15209 – redundant error message on invalid field access
Status
RESOLVED
Resolution
FIXED
Severity
minor
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2015-10-16T02:47:00Z
Last change time
2016-01-03T14:02:09Z
Keywords
diagnostic, pull
Assigned to
nobody
Creator
k.hara.pg
Comments
Comment #0 by k.hara.pg — 2015-10-16T02:47:07Z
Test case:
----
class C1 { int x; }
struct S1 { alias y = C1.x; }
struct S2 { int x; }
class C2 { alias y = S2.x; }
void main()
{
S1 s1;
s1.y = 10; // Line 10: invalid field variable access
auto c2 = new C2();
c2.y = 10; // Line 13: invalid field variable access
}
Output:
----
test.d(10): Error: struct test.S1 'x' is not a member
test.d(10): Error: need 'this' for 'x' of type 'int'
test.d(13): Error: need 'this' for 'x' of type 'int'
The error "is not a member" at line 10 is redundant.