llvm-project/clang/test/Modules/vtable-in-explicit-instantiation.cppm
Chuanqi Xu 05861b39ba
[C++20] [Modules] Make sure vtable are generated for explicit template instantiation definition (#123871)
Close https://github.com/llvm/llvm-project/issues/123719

The reason is, we thought the external explicit template instantiation
declaration as the external definition incorrectly.
2025-01-22 12:30:31 +08:00

35 lines
862 B
C++

// RUN: rm -rf %t
// RUN: mkdir %t
// RUN: split-file %s %t
// RUN: %clang_cc1 -std=c++20 %t/a.cppm -triple %itanium_abi_triple -emit-module-interface -o %t/a.pcm
// RUN: %clang_cc1 -std=c++20 %t/a.cc -triple %itanium_abi_triple -fmodule-file=a=%t/a.pcm -emit-llvm -o - | FileCheck %t/a.cc
//
// RUN: %clang_cc1 -std=c++20 %t/a.cppm -triple %itanium_abi_triple -emit-reduced-module-interface -o %t/a.pcm
// RUN: %clang_cc1 -std=c++20 %t/a.cc -triple %itanium_abi_triple -fmodule-file=a=%t/a.pcm -emit-llvm -o - | FileCheck %t/a.cc
//--- a.cppm
export module a;
class base {
public:
~base() = default;
virtual void foo();
};
template <class T>
class a : public base {
public:
virtual void foo() override;
};
extern template class a<int>;
//--- a.cc
module a;
template <class T>
void a<T>::foo() {}
template class a<int>;
// CHECK: _ZTVW1a1aIiE