Skip to content

Commit 55d5ba9

Browse files
committed
[NFC] Fix compilation in C++20 mode with GCC 12
I ran into the following compiler error when trying to build with GCC 12 and `-DCMAKE_CXX_STANDARD=20`: ``` llvm-project/clang/lib/Sema/SemaChecking.cpp:16690:16: required from here /usr/include/c++/12/type_traits:971:30: error: default member initializer for '{anonymous}::SequenceChecker::Usage::UsageExpr' required before the end of its enclosing class ``` The error seems correct, GCC just instantiates the `SmallDenseMap` early and detects it. Clang does not, but that's an acceptable implementation difference as far as the standard is concerned. Move constructor outside the class to avoid this problem.
1 parent 21fe8b6 commit 55d5ba9

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

clang/lib/Sema/SemaChecking.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16677,7 +16677,7 @@ class SequenceChecker : public ConstEvaluatedExprVisitor<SequenceChecker> {
1667716677
/// Have we issued a diagnostic for this object already?
1667816678
bool Diagnosed = false;
1667916679

16680-
UsageInfo() = default;
16680+
UsageInfo();
1668116681
};
1668216682
using UsageInfoMap = llvm::SmallDenseMap<Object, UsageInfo, 16>;
1668316683

@@ -17436,6 +17436,8 @@ class SequenceChecker : public ConstEvaluatedExprVisitor<SequenceChecker> {
1743617436
}
1743717437
};
1743817438

17439+
SequenceChecker::UsageInfo::UsageInfo() = default;
17440+
1743917441
} // namespace
1744017442

1744117443
void Sema::CheckUnsequencedOperations(const Expr *E) {

0 commit comments

Comments
 (0)