Skip to content

Commit 4b35dd5

Browse files
committed
[Serialization] Try to clean up PendingUndeducedFunctionDecls when
PendingUndeducedFunctionDecls is not empty Close #120277 This turns out to be a simple oversight initially. See the analysis in ba1e84f for the wider background.
1 parent 21996bd commit 4b35dd5

File tree

2 files changed

+60
-1
lines changed

2 files changed

+60
-1
lines changed

clang/lib/Serialization/ASTReader.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -10642,7 +10642,8 @@ void ASTReader::FinishedDeserializing() {
1064210642
// We do this now rather than in finishPendingActions because we want to
1064310643
// be able to walk the complete redeclaration chains of the updated decls.
1064410644
while (!PendingExceptionSpecUpdates.empty() ||
10645-
!PendingDeducedTypeUpdates.empty()) {
10645+
!PendingDeducedTypeUpdates.empty() ||
10646+
!PendingUndeducedFunctionDecls.empty()) {
1064610647
auto ESUpdates = std::move(PendingExceptionSpecUpdates);
1064710648
PendingExceptionSpecUpdates.clear();
1064810649
for (auto Update : ESUpdates) {

clang/test/Modules/pr120277.cppm

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
// RUN: rm -rf %t
2+
// RUN: mkdir -p %t
3+
// RUN: split-file %s %t
4+
//
5+
// RUN: %clang_cc1 -std=c++20 %t/a.cppm -emit-module-interface -o %t/a.pcm
6+
// RUN: %clang_cc1 -std=c++20 %t/b.cppm -emit-module-interface -o %t/b.pcm \
7+
// RUN: -fprebuilt-module-path=%t
8+
// RUN: %clang_cc1 -std=c++20 %t/c.cppm -emit-module-interface -o %t/c.pcm \
9+
// RUN: -fprebuilt-module-path=%t
10+
// RUN: %clang_cc1 -std=c++20 %t/d.cppm -emit-module-interface -o %t/d.pcm \
11+
// RUN: -fprebuilt-module-path=%t
12+
// RUN: %clang_cc1 -std=c++20 %t/d.pcm -emit-llvm -o %t/d.ll \
13+
// RUN: -fprebuilt-module-path=%t
14+
// RUN: cat %t/d.ll | FileCheck %t/d.cppm
15+
16+
//--- a.cppm
17+
export module a;
18+
19+
export template<int>
20+
struct a {
21+
static auto f() {
22+
}
23+
};
24+
25+
//--- b.cppm
26+
export module b;
27+
28+
import a;
29+
30+
void b() {
31+
a<0> t;
32+
}
33+
34+
//--- c.cppm
35+
export module c;
36+
37+
import a;
38+
39+
void c() {
40+
a<0>::f();
41+
}
42+
43+
//--- d.cppm
44+
export module d;
45+
46+
import a;
47+
import b;
48+
import c;
49+
50+
struct d {
51+
static void g() {
52+
a<0>::f();
53+
a<1>::f();
54+
}
55+
};
56+
57+
// fine enough to check it won't crash
58+
// CHECK: define

0 commit comments

Comments
 (0)