Skip to content

[C++20] [Modules] Do we need the concept of key function for class defined in module purview? #170

Open
@ChuanqiXu9

Description

@ChuanqiXu9

See llvm/llvm-project#70585 for the motivation issue.

Simply, the current clang's behavior violates itanium ABI 5.2.3:

The virtual table for a class is emitted in the same object containing the definition of its key function, i.e. the first non-pure virtual function that is not inline at the point of class definition.

But there are opinions about: is the concept of key function necessary after we introducing modules? So I bring the issue here.

My thought about the key function is that: in the headers model, the class may be defined in many TUs, then we need to find a TU to generate the virtual table. But after we introducing modules, if we define the class is defined is a module purview, we can get the TU to generate the virtual table naturally.

My understanding to the issues is: while the original old rule works, maybe it is better to have some new rules with the new features technically.

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