Browse Source

Merge pull request #52123 from lightspot21/fix-placement-new-warning

Silence false-positive warning for malformed placement new on GCC 11.1
Rémi Verschelde 4 years ago
parent
commit
3705ad7d8f
1 changed files with 10 additions and 0 deletions
  1. 10 0
      core/templates/cowdata.h

+ 10 - 0
core/templates/cowdata.h

@@ -49,6 +49,12 @@ class VMap;
 SAFE_NUMERIC_TYPE_PUN_GUARANTEES(uint32_t)
 #endif
 
+// Silence a false positive warning (see GH-52119).
+#if defined(__GNUC__) && !defined(__clang__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wplacement-new"
+#endif
+
 template <class T>
 class CowData {
 	template <class TV>
@@ -380,4 +386,8 @@ CowData<T>::~CowData() {
 	_unref(_ptr);
 }
 
+#if defined(__GNUC__) && !defined(__clang__)
+#pragma GCC diagnostic pop
+#endif
+
 #endif // COWDATA_H