Skip to content

DMD compiles class with undefined interface functions -- resulting in runtime crash #23631

Description

@puneet
interface intf {
  bool func();
}

abstract class abs: intf
{
  void check( ) {
    import std.stdio: writefln;
    writefln("func: %s -- %s",
        cast(void*) (&func).funcptr,
        cast(void*) (&func).ptr);
    func();            // craches at runtime
  }
}

class ovd: abs { }        // this should not compile

void main() {
  ovd foo = new ovd();
  foo.check();
}
$ dmd --version
DMD64 D Compiler v2.113.0-rc.1
Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved written by Walter Bright
$ rdmd --force test.d
func: null -- 7ED881E8B010
Segmentation fault (core dumped)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions