D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 20861 - Interface implementations are not checked when code gen is skipped
Summary: Interface implementations are not checked when code gen is skipped
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P1 critical
Assignee: No Owner
URL:
Keywords: pull
Depends on:
Blocks:
 
Reported: 2020-05-24 14:12 UTC by Jacob Carlborg
Modified: 2020-05-30 14:41 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Jacob Carlborg 2020-05-24 14:12:34 UTC
The following code should fail to compile but doesn't when code gen is skipped, i.e. the `-o-` flag is used:

interface Foo
{
    void foo();
}

class Bar : Foo
{

}

The reason being that the check if a class implements all methods of an interface is performed when generating code for the vtable.
Comment 1 Dlang Bot 2020-05-28 05:46:49 UTC
@jacob-carlborg created dlang/dmd pull request #11191 "Fix issue 20861: Interface implementations are not checked when code gen is skipped" fixing this issue:

- Fix issue 20861: Interface implementations are not checked when code gen is skipped
  
  The problem being that check was performed when the vtable was
  generated, during code generation. If the compiler was invoked with
  `-o-`, which skips code generation, the check was not performed. The
  fix is to move the check to the semantic phase of the compilation.
  
  This is also required for Objective-C classes, which don't have a
  vtable at all, even during code generation.

https://github.com/dlang/dmd/pull/11191
Comment 2 Dlang Bot 2020-05-30 14:41:42 UTC
dlang/dmd pull request #11191 "Fix issue 20861: Interface implementations are not checked when code gen is skipped" was merged into master:

- 56ebebf05467ea4069a36c584529f3b7dbb562ad by Jacob Carlborg:
  Fix issue 20861: Interface implementations are not checked when code gen is skipped
  
  The problem being that check was performed when the vtable was
  generated, during code generation. If the compiler was invoked with
  `-o-`, which skips code generation, the check was not performed. The
  fix is to move the check to the semantic phase of the compilation.
  
  This is also required for Objective-C classes, which don't have a
  vtable at all, even during code generation.

https://github.com/dlang/dmd/pull/11191