https://github.com/mpark updated https://github.com/llvm/llvm-project/pull/126349
>From eac633d78359245f1ce478b5f3cff26c6f5c858f Mon Sep 17 00:00:00 2001 From: Michael Park <mcyp...@gmail.com> Date: Fri, 7 Feb 2025 21:23:26 -0800 Subject: [PATCH 1/2] [C++20][Modules][Serialization] Add an additional test case for #120277. https://github.com/llvm/llvm-project/commit/4b35dd57b88a59b169c3471cbc398113d3bf98e8 was shipped to address https://github.com/llvm/llvm-project/issues/120277 . It was thought to be a regression in 19.x according to this comment: https://github.com/llvm/llvm-project/issues/120277#issuecomment-2558991129 This is a test case that fails even in 17.x but nevertheless is also fixed by: https://github.com/llvm/llvm-project/commit/4b35dd57b88a59b169c3471cbc398113d3bf98e8 . --- clang/test/Modules/pr120277-2.cpp | 67 +++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 clang/test/Modules/pr120277-2.cpp diff --git a/clang/test/Modules/pr120277-2.cpp b/clang/test/Modules/pr120277-2.cpp new file mode 100644 index 000000000000000..21d24207c920dac --- /dev/null +++ b/clang/test/Modules/pr120277-2.cpp @@ -0,0 +1,67 @@ +// RUN: rm -rf %t +// RUN: mkdir -p %t +// RUN: split-file %s %t +// RUN: cd %t + +// RUN: %clang_cc1 -std=c++20 -emit-header-unit -xc++-user-header %t/hu-01.h \ +// RUN: -o %t/hu-01.pcm + +// RUN: %clang_cc1 -std=c++20 -emit-header-unit -xc++-user-header %t/hu-02.h \ +// RUN: -Wno-experimental-header-units -fmodule-file=%t/hu-01.pcm -o %t/hu-02.pcm + +// RUN: %clang_cc1 -std=c++20 -emit-header-unit -xc++-user-header %t/hu-03.h \ +// RUN: -Wno-experimental-header-units \ +// RUN: -fmodule-file=%t/hu-01.pcm -o %t/hu-03.pcm + +// RUN: %clang_cc1 -std=c++20 -emit-header-unit -xc++-user-header %t/hu-04.h \ +// RUN: -Wno-experimental-header-units -fmodule-file=%t/hu-02.pcm \ +// RUN: -fmodule-file=%t/hu-03.pcm -o %t/hu-04.pcm + +// RUN: %clang_cc1 -std=c++20 -emit-obj %t/main.cpp \ +// RUN: -Wno-experimental-header-units -fmodule-file=%t/hu-04.pcm +//--- hu-01.h +template <typename T> +struct A { + ~A() { f(); } + auto f() const { return 0; } +}; + +template <typename T> +struct B { + int g() const { return a.f(); } + A<T> a; +}; + +//--- hu-02.h +import "hu-01.h"; + +template <typename = void> +struct C { + void h() { + B<int>().g(); + } +}; + +template struct A<double>; + +//--- hu-03.h +import "hu-01.h"; + +inline B<int> b() { + return {}; +} + +//--- hu-04.h +import "hu-02.h"; +import "hu-03.h"; + +inline void f4() { + C{}.h(); +} + +//--- main.cpp +import "hu-04.h"; + +int main() { + f4(); +} >From 8fd10c5268bcd4732cf1b69eaed23694f8bf69d9 Mon Sep 17 00:00:00 2001 From: Michael Park <mcyp...@gmail.com> Date: Sat, 8 Feb 2025 22:28:06 -0800 Subject: [PATCH 2/2] Update clang/test/Modules/pr120277-2.cpp Co-authored-by: Chuanqi Xu <yedeng...@linux.alibaba.com> --- clang/test/Modules/pr120277-2.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/clang/test/Modules/pr120277-2.cpp b/clang/test/Modules/pr120277-2.cpp index 21d24207c920dac..f3a7e4743184864 100644 --- a/clang/test/Modules/pr120277-2.cpp +++ b/clang/test/Modules/pr120277-2.cpp @@ -1,7 +1,6 @@ // RUN: rm -rf %t // RUN: mkdir -p %t // RUN: split-file %s %t -// RUN: cd %t // RUN: %clang_cc1 -std=c++20 -emit-header-unit -xc++-user-header %t/hu-01.h \ // RUN: -o %t/hu-01.pcm _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits