Skip to content

[C++20] [Modules] Multiple definitions for type info (virtual tables) #61940

@rnikander

Description

@rnikander

Here's the example code. There is a base class in one partition, a subclass in another. I think it should work.

https://godbolt.org/z/W4nWj6G7E

The error is currently:

/opt/compiler-explorer/gcc-snapshot/lib/gcc/x86_64-linux-gnu/13.0.1/../../../../x86_64-linux-gnu/bin/ld: 
CMakeFiles/mod_bug6.dir/Base.cc.o:(.rodata+0x0): multiple definition of `_ZTSW3Mod4Base'; 
CMakeFiles/mod_bug6.dir/main.cc.o:(.rodata+0x0): first defined here
clang++: error: linker command failed with exit code 1 (use -v to see invocation)

On my laptop it's easier to read:

duplicate symbol 'typeinfo name for Base@Mod' in:
    ModBug6/CMakeFiles/mod_bug6.dir/main.cc.o
    ModBug6/CMakeFiles/mod_bug6.dir/Base.cc.o
duplicate symbol 'typeinfo for Base@Mod' in:
    ModBug6/CMakeFiles/mod_bug6.dir/main.cc.o
    ModBug6/CMakeFiles/mod_bug6.dir/Base.cc.o
ld: 2 duplicate symbols for architecture x86_64

Metadata

Metadata

Assignees

Labels

clang:modulesC++20 modules and Clang Header Modules

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions