Bug 2643 – Front-end should check for unimplemented interface functions
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2009-02-03T02:39:41Z
Last change time
2020-08-06T14:23:12Z
Keywords
accepts-invalid, bootcamp, diagnostic
Assigned to
No Owner
Creator
anonymous4
Comments
Comment #0 by dfj1esp02 — 2009-02-03T02:39:41Z
---
module Test;
interface NetworkListener
{
void onConnect();
}
class SoundManager : private NetworkListener
{
private final void onConnect()
{
}
}
---
compiling this code with -c -o- switches yields no error messages, while compilation with -c switch yields error.
>dmd -c tmp.d -o- -I.. -w
>dmd -c tmp.d -I.. -w
tmp.d(16): class Test.SoundManager interface function NetworkListener.onConnect isn't implemented
Comment #1 by shro8822 — 2009-02-03T10:46:01Z
that's not a bug if you look at it a different way; -o- is to allow generating ddoc output without having to run everything.
OTOH if you see it as run a test build but don't generate object files...
Comment #2 by dfj1esp02 — 2009-02-05T04:16:11Z
> that's not a bug if you look at it a different way; -o- is to allow generating
> ddoc output without having to run everything.
not everything, just object file generation
> OTOH if you see it as run a test build but don't generate object files...
well then this feature should be better documented, because *some* semantic analysis is *done* with -o- switch. I suspect that this surprise only pops up when compiler tries to build class's vtbl at codegen step, which means that semantic analysis is not fully done at right time. I intensively use gcc -fsyntax-only and never run into trouble with it, in spite of the switch name, it seems like it does full semantic analysis.
Comment #3 by shro8822 — 2009-02-05T11:58:01Z
At some point I home that DMD will actual do more semantic stuff under -o- as then I can get DDoc output for generated code. However even then DMD should only do what is needed to generate the requested output.
Comment #4 by tomas — 2009-02-05T12:07:09Z
DMD actually does quite a bit of error handling during code generation. I've been hit by this several times in LDC, where it means that quite a lot of the time, you can't be sure the AST you're generating code for is valid.
I would love to see this fixed as well, but I can also understand that some errors are a lot simpler to detect at the codegen stage, so it worth the performance tradeoff ?
I'm not sure.
Comment #5 by yebblies — 2011-06-10T08:50:09Z
*** Issue 5947 has been marked as a duplicate of this issue. ***
Comment #6 by clugdbug — 2013-07-22T01:40:46Z
This is not just an issue with -o-. Because the error is only generated in the glue layer, it isn't prevented from being sent to CTFE.
This means that in some circumstances, in CTFE, you can successfully call a function which the compiler says does not exist!!
Comment #7 by pro.mathias.lang — 2020-08-06T14:23:12Z