Bug 204 – Error message on attempting to instantiate an abstract class needs to be improved

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2006-06-17T14:32:00Z
Last change time
2015-06-09T05:15:19Z
Keywords
diagnostic
Assigned to
bugzilla
Creator
dawid.ciezarkiewicz

Comments

Comment #0 by dawid.ciezarkiewicz — 2006-06-17T14:32:47Z
map.d(165): cannot create instance of abstract class Droid Please add info about method which isn't implemented yet: "because XXX is abstract" or smth. If many - the first one is good enought.
Comment #1 by matti.niemenmaa+dbugzilla — 2006-06-18T10:09:01Z
To show the issue more clearly: -- class Foo { abstract void foo(); } class Bar : Foo {} void main() { Bar bar = new Bar(); } -- The code fails with "cannot create instance of abstract class Bar". What is being asked for is an error message which would, in this instance, clarify that the reason the instantiation fails is that the method foo() is unimplemented in Bar.
Comment #2 by digitalmars-com — 2006-09-28T17:11:08Z
I think this is an important usability/productivity issue. Althought I don't know the internals of the DMD compiler, I would expect the compiler to know what is missing before deciding it can't create an instance. Therefore it should be a simple matter to add that information to the error message. In addition, I think this gives DMD, and hence the D language, a feeling of incompleteness. Something which may be a hinderance to wider usage.
Comment #3 by braddr — 2007-01-27T01:34:48Z
This is represented by dstress test: http://dstress.kuehne.cn/nocompile/a/abstract_14.d
Comment #4 by smjg — 2007-01-27T08:00:47Z
// __DSTRESS_ELINE__ 19 Why line 19? Why not 16, where the abstract method is declared?
Comment #5 by fvbommel — 2007-01-27T09:57:44Z
(In reply to comment #4) > // __DSTRESS_ELINE__ 19 > > Why line 19? Why not 16, where the abstract method is declared? I'd prefer both: 16 to indicate *which* abstract method isn't declared, and 19 to indicate *where* it isn't declared.
Comment #6 by fvbommel — 2007-01-27T10:09:49Z
(In reply to comment #5) > (In reply to comment #4) > > // __DSTRESS_ELINE__ 19 > > > > Why line 19? Why not 16, where the abstract method is declared? > > I'd prefer both: 16 to indicate *which* abstract method isn't declared, and 19 > to indicate *where* it isn't declared. s/declared/implemented/g (For the less sed-aware: replace both instances of "declared" in above comment with "implemented")
Comment #7 by matti.niemenmaa+dbugzilla — 2007-11-28T02:27:45Z
Fixed in 1.024.
Comment #8 by bugzilla — 2007-12-04T23:34:38Z
Fixed dmd 1.024 and 2.008