[clang] [Clang][Sema]: Allow copy constructor side effects (PR #81127)

Vlad Serebrennikov via cfe-commits cfe-commits at lists.llvm.org
Sat Feb 10 06:41:21 PST 2024


================
@@ -183,7 +185,12 @@ void foo(int size) {
   NonTriviallyDestructible array[2];  // no warning
   NonTriviallyDestructible nestedArray[2][2]; // no warning
 
+  // Copy initialzation gives warning before C++17
+#if __cplusplus <= 201402L
   Foo fooScalar = 1; // expected-warning {{unused variable 'fooScalar'}}
+#else
+  Foo fooScalar = 1; // no warning
----------------
Endilll wrote:

Here is documentation for `-verify` if you feel you need it: https://clang.llvm.org/docs/InternalsManual.html#verifying-diagnostics

https://github.com/llvm/llvm-project/pull/81127


More information about the cfe-commits mailing list