Bug 1680 – (D1 only) static struct constructor overloaded with method prevents compilation in inner function

Status
RESOLVED
Resolution
WONTFIX
Severity
major
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
All
OS
All
Creation time
2007-11-20T23:05:36Z
Last change time
2019-05-11T16:55:12Z
Keywords
pull, rejects-valid
Assigned to
No Owner
Creator
Steven Schveighoffer

Comments

Comment #0 by schveiguy — 2007-11-20T23:05:36Z
Not sure if this is the minimal case. Also happens on d 1.023 struct X { int _y; int blah() { return _y; } static X blah(int n) { return X(n); } static X blah2(int n) { return X(n); } static X blah2(char[] n) { return X(n.length); } } void main() { // OK X v = X.blah(5); void f() { // OK X v1 = X.blah2(5); X v2 = X.blah2("hello".dup); // Error: 'this' is only allowed in non-static member functions, not f X v3 = X.blah(5); } }
Comment #1 by k.hara.pg — 2013-02-23T20:36:43Z
Comment #2 by bugzilla — 2013-03-01T02:44:31Z
Fixed for D2.