D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 2643 - Front-end should check for unimplemented interface functions
Summary: Front-end should check for unimplemented interface functions
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P2 normal
Assignee: No Owner
URL:
Keywords: accepts-invalid, bootcamp, diagnostic
: 5947 (view as issue list)
Depends on:
Blocks:
 
Reported: 2009-02-03 02:39 UTC by anonymous4
Modified: 2020-08-06 14:23 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description anonymous4 2009-02-03 02:39:41 UTC
---
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 BCS 2009-02-03 10:46:01 UTC
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 anonymous4 2009-02-05 04:16:11 UTC
> 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 BCS 2009-02-05 11:58:01 UTC
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 Tomas Lindquist Olsen 2009-02-05 12:07:09 UTC
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 yebblies 2011-06-10 08:50:09 UTC
*** Issue 5947 has been marked as a duplicate of this issue. ***
Comment 6 Don 2013-07-22 01:40:46 UTC
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 Mathias LANG 2020-08-06 14:23:12 UTC
Fixed by https://github.com/dlang/dmd/pull/11191