digitalmars.D.bugs - [Issue 236] New: Class literal expression always says "base classes expected"
- d-bugmail puremagic.com (44/44) Jul 02 2006 http://d.puremagic.com/issues/show_bug.cgi?id=236
- d-bugmail puremagic.com (9/9) Jul 18 2006 http://d.puremagic.com/issues/show_bug.cgi?id=236
- Thomas Kuehne (12/42) Aug 15 2006 -----BEGIN PGP SIGNED MESSAGE-----
http://d.puremagic.com/issues/show_bug.cgi?id=236
Summary: Class literal expression always says "base classes
expected"
Product: D
Version: 0.162
Platform: PC
OS/Version: Windows
Status: NEW
Keywords: rejects-valid
Severity: normal
Priority: P2
Component: DMD
AssignedTo: bugzilla digitalmars.com
ReportedBy: jarrett.billingsley gmail.com
I never ran into this before, and I kind of wonder why.
void delegate() foo()
{
return &(new class
{
void dg()
{
writefln("delegate!");
}
}).dg;
}
This gives the error "base classes expected" for the class literal. I guess I
never ran into it because all the class literals I ever wrote derived from
other classes. I tried this in several versions of DMD all the way back to
0.126, and they all give the same error. According to the spec, base classes
are optional for class literals. I should be able to write "new class {}" and
it should be fine.
The semantic equivalent works just fine:
void delegate() foo()
{
class fofof
{
void dg()
{
writefln("delegate!");
}
}
return &(new fofof).dg;
}
--
Jul 02 2006
http://d.puremagic.com/issues/show_bug.cgi?id=236
jpelcis gmail.com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
Fixed DMD 0.163.
--
Jul 18 2006
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 d-bugmail puremagic.com schrieb am 2006-07-02:http://d.puremagic.com/issues/show_bug.cgi?id=236I never ran into this before, and I kind of wonder why. void delegate() foo() { return &(new class { void dg() { writefln("delegate!"); } }).dg; } This gives the error "base classes expected" for the class literal. I guess I never ran into it because all the class literals I ever wrote derived from other classes. I tried this in several versions of DMD all the way back to 0.126, and they all give the same error. According to the spec, base classes are optional for class literals. I should be able to write "new class {}" and it should be fine. The semantic equivalent works just fine: void delegate() foo() { class fofof { void dg() { writefln("delegate!"); } } return &(new fofof).dg; }Added to DStress as http://dstress.kuehne.cn/run/c/class_26_A.d http://dstress.kuehne.cn/run/c/class_26_B.d Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFE4Z86LK5blCcjpWoRAnVaAJ91paqlf+5cmbO8IhSRRAdOHuMnEQCdE8Lp /MUhZsGnq18Le2uppLjHkdE= =z9aB -----END PGP SIGNATURE-----
Aug 15 2006









d-bugmail puremagic.com 