re PR c++/35878 ([LWG 2302] Useless NULL pointer check when constructing object)
[official-gcc.git] / gcc / testsuite / g++.dg / init / pr35878_3.C
blob8a5614f12ffc0afb31ca744351503382b2c3001e
1 // { dg-options "-O2 --std=gnu++17" }
2 // { dg-do compile }
3 // { dg-final { scan-assembler-not "test.*%rdi, %rdi" { target i?86-*-* x86_64-*-* } } }
4 #include <new>
5 #include <utility>
7 struct s1{
8   int a;
9   int b;
10   int c;
13 void f1 (s1 * v, s1&& s)
15         new (v) s1(std::move(s));
18 void f2 (s1 * v, s1&& s)
20         *v = std::move(s);