[Issue 1680] New: static struct constructor overloaded with method prevents compilation in inner function
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Nov 20 21:05:43 PST 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1680
Summary: static struct constructor overloaded with method
prevents compilation in inner function
Product: D
Version: 2.007
Platform: PC
OS/Version: All
Status: NEW
Keywords: rejects-valid
Severity: major
Priority: P2
Component: DMD
AssignedTo: bugzilla at digitalmars.com
ReportedBy: schveiguy at yahoo.com
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);
}
}
--
More information about the Digitalmars-d-bugs
mailing list