[PATCH] D131258: [Sema] Merge variable template specializations
Chuanqi Xu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sun Aug 7 20:53:18 PDT 2022
ChuanqiXu added a comment.
When I run this locally, it emits several unexpected errors:
While building module 'library':
In file included from <module-includes>:2:
/disk2/workspace.xuchuanqi/llvm-project-for-work/build/tools/clang/test/Modules/Output/merge-var-template-spec.cpp.tmp/var2.h:4:32: error: redefinition of 'zero'
template <class T> constexpr T zero = 0;
^
/disk2/workspace.xuchuanqi/llvm-project-for-work/build/tools/clang/test/Modules/Output/merge-var-template-spec.cpp.tmp/var1.h:4:32: note: previous definition is here
template <class T> constexpr T zero = 0;
^
While building module 'library':
In file included from <module-includes>:2:
/disk2/workspace.xuchuanqi/llvm-project-for-work/build/tools/clang/test/Modules/Output/merge-var-template-spec.cpp.tmp/var2.h:5:8: error: redefinition of 'Int'
struct Int {
^
/disk2/workspace.xuchuanqi/llvm-project-for-work/build/tools/clang/test/Modules/Output/merge-var-template-spec.cpp.tmp/var1.h:5:8: note: previous definition is here
struct Int {
^
While building module 'library':
In file included from <module-includes>:2:
/disk2/workspace.xuchuanqi/llvm-project-for-work/build/tools/clang/test/Modules/Output/merge-var-template-spec.cpp.tmp/var2.h:8:27: error: redefinition of 'zero<Int>'
template <> constexpr int zero<Int> = {0};
^
/disk2/workspace.xuchuanqi/llvm-project-for-work/build/tools/clang/test/Modules/Output/merge-var-template-spec.cpp.tmp/var1.h:8:27: note: previous definition is here
template <> constexpr int zero<Int> = {0};
^
While building module 'library':
In file included from <module-includes>:2:
/disk2/workspace.xuchuanqi/llvm-project-for-work/build/tools/clang/test/Modules/Output/merge-var-template-spec.cpp.tmp/var2.h:9:33: error: redefinition of 'zero<T *>'
template <class T> constexpr T* zero<T*> = nullptr;
^
/disk2/workspace.xuchuanqi/llvm-project-for-work/build/tools/clang/test/Modules/Output/merge-var-template-spec.cpp.tmp/var1.h:9:33: note: previous definition is here
template <class T> constexpr T* zero<T*> = nullptr;
^
4 errors generated.
================
Comment at: clang/test/Modules/merge-var-template-spec-cxx-modules.cpp:1
+// RUN: rm -rf %t
+// RUN: mkdir %t
----------------
Maybe it is better to rename this as `merge-var-template-spec.cppm` since we uses the suffix `.cppm` as a note for c++20 modules.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D131258/new/
https://reviews.llvm.org/D131258
More information about the cfe-commits
mailing list