【发布时间】:2019-12-05 17:48:35
【问题描述】:
我想export (C++20) 一个别名模板。 VC++ 2019 编译代码。 Clang 报告错误。哪一个是正确的,为什么?
// file: m.cppm
export module m;
template<typename T> struct my_template {};
export template<typename T> using my_alias = my_template<T>;
// file: main.cpp
import m;
int main() { my_alias<int> v; }
main.cpp:2:28: error: definition of 'my_template' must be imported from module 'm' before it is required
int main() { my_alias<int> v; }
^
m.cppm:3:29: note: previous definition is here
template<typename T> struct my_template {};
【问题讨论】: