[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:37:20 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:
Code around here can be replaced with a single line:
```
Foo fooScalar = 1; // cxx98-14-warning {{unused variable 'fooScalar'}}
```
Look at DR tests again how to make this happen (via `-verify=`):
https://github.com/llvm/llvm-project/blob/3902f9b6e2d925d50f9a4861d78e5aba07b6ef11/clang/test/CXX/drs/dr0xx.cpp#L1-L3
https://github.com/llvm/llvm-project/pull/81127
More information about the cfe-commits
mailing list