Skip to content

[clang-repl] "Duplicate Definition of Symbol" for out of line definition for virtual function #141039

Open
@Vipul-Cariappa

Description

@Vipul-Cariappa

clang-repl raises "Duplicate Definition of Symbol", when creating an object with an out-of-line virtual function.

clang-repl> struct Klass { virtual int get_value(); };
clang-repl> int Klass::get_value() { return 0; }
clang-repl> auto x1 = Klass();
error: Duplicate definition of symbol '_ZTV5Klass'
clang-repl> %quit

But if the virtual function in defined within the class, it does not raise the error:

clang-repl> struct Klass { virtual int get_value() { return 0; } };
clang-repl> auto x1 = Klass();
clang-repl> %quit

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