-
Notifications
You must be signed in to change notification settings - Fork 13.5k
[clang] Polymorhic class templates are broken in modules #97313
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Labels
clang:modules
C++20 modules and Clang Header Modules
Comments
@llvm/issue-subscribers-clang-modules Author: Marcin Nowak (jasiolpn)
Hello,
Looks like I've found a new bug. I've compiled fresh LLVM (last commit ae570d8) and I tried to compile following files:
// Base.cppm
export module Mod:Base;
export template <class>
class Base
{
public:
constexpr Base();
constexpr virtual ~Base();
};
template <class X>
constexpr Base<X>::Base() = default;
template <class X>
constexpr Base<X>::~Base() = default; // Sub.cppm
export module Mod:Sub;
import :Base;
export class Sub : public Base<int>
{
}; // Mod.cppm
export module Mod;
export import :Base;
export import :Sub; // main.cpp
import Mod;
int main()
{
Base<int> *b = new Sub();
delete b;
} Those files are compiled but the linker says:
What is interesting is that if I make |
lravenclaw
pushed a commit
to lravenclaw/llvm-project
that referenced
this issue
Jul 3, 2024
named modules Close llvm#97313 In the previous patch (llvm#75912), I made an oversight that I ignored the templates in named module when calculating the linkage for the vtables. In this patch, I tried to correct the behavior by merging the logics to calculate the linkage with key functions with named modules.
kbluck
pushed a commit
to kbluck/llvm-project
that referenced
this issue
Jul 6, 2024
named modules Close llvm#97313 In the previous patch (llvm#75912), I made an oversight that I ignored the templates in named module when calculating the linkage for the vtables. In this patch, I tried to correct the behavior by merging the logics to calculate the linkage with key functions with named modules.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello,
Looks like I've found a new bug. I've compiled fresh LLVM (last commit ae570d8) and I tried to compile following files:
Those files are compiled but the linker says:
What is interesting is that if I make
Base
not to be template linker is doing its job successfully.The text was updated successfully, but these errors were encountered: