Skip to content

[MS ABI] Clang doesn't generate local vftables with dllimport #23923

Open
@majnemer

Description

@majnemer
mannequin
Bugzilla Link 23549
Version unspecified
OS All
Blocks #12849
CC @DougGregor,@jyu2-git,@zahiraam

Extended Description

consider:

struct _declspec(dllimport) A {
  A()
  virtual ~A();
};

A *f() { return new A();}

MSVC generates:
This calls operator new and the imported A constructor. However, it also overwrites the VFPtr with a so-called "local vftable". I suspect this is to support overriding the global operator new and delete.

More information is available here:
https://groups.google.com/d/msg/microsoft.public.vc.language/atSh_2VSc2w/EgJ3r_7OzVUJ

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions