Bug 13305 – Inconsistency in empty class and interface parsing

Status
NEW
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-08-16T06:56:54Z
Last change time
2024-12-13T18:24:10Z
Assigned to
No Owner
Creator
briancschott
Blocks
10233
Moved to GitHub: dmd#18868 →

Comments

Comment #0 by briancschott — 2014-08-16T06:56:54Z
interface A; class B; interface C {} class D {} interface E : C; // Fails class F : C; // Fails interface G : C {} // Passes class H : C {} // Passes Interfaces and classes are only allowed to have ";" as their body if they do not inherit from another interface. Why is this?
Comment #1 by k.hara.pg — 2014-09-22T02:00:37Z
I guess that the limitation has came from C++ class declaration syntax. // C++ code class C {}; class D : public C; // NG But I'm not sure the opaque class declaration with base class/interfaces can work with current ABI. For example: class C { void foo() {} } class I { void bar(); } class D : C, I; // opaque with base class/interfaces D makeD(); void main() { D d = makeD(); d.foo(); // might work d.bar(); // can work...? vtbl of any base interfaces may not be accessible // because __traits(classInstanceSize, D) is unknown. }
Comment #2 by robert.schadek — 2024-12-13T18:24:10Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/18868 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB