https://github.com/d0k created https://github.com/llvm/llvm-project/pull/212042
In C++20 (P1008R1 https://wg21.link/p1008r1), aggregates are prohibited from having any user-declared constructors, even if they are = delete or = default. >From 59adcfcd59b0335abcababb0570d0263c10825f8 Mon Sep 17 00:00:00 2001 From: Benjamin Kramer <[email protected]> Date: Sat, 25 Jul 2026 19:19:29 +0200 Subject: [PATCH] [ThreadSafety] Fix C++20 build In C++20 (P1008R1 https://wg21.link/p1008r1), aggregates are prohibited from having any user-declared constructors, even if they are = delete or = default. --- clang/lib/Analysis/ThreadSafety.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/clang/lib/Analysis/ThreadSafety.cpp b/clang/lib/Analysis/ThreadSafety.cpp index 2b394865c5a5e..fe94910e905a3 100644 --- a/clang/lib/Analysis/ThreadSafety.cpp +++ b/clang/lib/Analysis/ThreadSafety.cpp @@ -1802,9 +1802,13 @@ class BuildLockset : public ConstStmtVisitor<BuildLockset> { public: enum Point : char { Pre = 0, Post = 1 }; - struct ContextSwitchScope { + class ContextSwitchScope { DualLocalVarContext &DC; Point LastPoint; + + public: + ContextSwitchScope(DualLocalVarContext &DC, Point LastPoint) + : DC(DC), LastPoint(LastPoint) {} ContextSwitchScope(const ContextSwitchScope &) = delete; ContextSwitchScope &operator=(const ContextSwitchScope &) = delete; ~ContextSwitchScope() { DC.switchContextTo(LastPoint); } @@ -1814,7 +1818,7 @@ class BuildLockset : public ConstStmtVisitor<BuildLockset> { [[nodiscard]] ContextSwitchScope switchToContextForScope(Point P) { Point PriorPoint = CurrPoint; switchContextTo(P); - return ContextSwitchScope{*this, PriorPoint}; + return ContextSwitchScope(*this, PriorPoint); } /// Update the pre- and post-contexts to be associated with the next Stmt \p _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
