[clang] 55d5ba9 - [NFC] Fix compilation in C++20 mode with GCC 12
Ilya Biryukov via cfe-commits
cfe-commits at lists.llvm.org
Wed Jan 3 08:02:22 PST 2024
Author: Ilya Biryukov
Date: 2024-01-03T17:02:00+01:00
New Revision: 55d5ba905da0db55282dd3985761ddf3dd452fd1
URL: https://github.com/llvm/llvm-project/commit/55d5ba905da0db55282dd3985761ddf3dd452fd1
DIFF: https://github.com/llvm/llvm-project/commit/55d5ba905da0db55282dd3985761ddf3dd452fd1.diff
LOG: [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.
Added:
Modified:
clang/lib/Sema/SemaChecking.cpp
Removed:
################################################################################
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index da0570b7b0f1e6..3168d38dd66c36 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -16677,7 +16677,7 @@ class SequenceChecker : public ConstEvaluatedExprVisitor<SequenceChecker> {
/// Have we issued a diagnostic for this object already?
bool Diagnosed = false;
- UsageInfo() = default;
+ UsageInfo();
};
using UsageInfoMap = llvm::SmallDenseMap<Object, UsageInfo, 16>;
@@ -17436,6 +17436,8 @@ class SequenceChecker : public ConstEvaluatedExprVisitor<SequenceChecker> {
}
};
+SequenceChecker::UsageInfo::UsageInfo() = default;
+
} // namespace
void Sema::CheckUnsequencedOperations(const Expr *E) {
More information about the cfe-commits
mailing list