]>
Commit | Line | Data |
---|---|---|
83ffe9cd | 1 | // Copyright (C) 2018-2023 Free Software Foundation, Inc. |
71e09389 JW |
2 | // |
3 | // This file is part of the GNU ISO C++ Library. This library is free | |
4 | // software; you can redistribute it and/or modify it under the | |
5 | // terms of the GNU General Public License as published by the | |
6 | // Free Software Foundation; either version 3, or (at your option) | |
7 | // any later version. | |
8 | ||
9 | // This library is distributed in the hope that it will be useful, | |
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | // GNU General Public License for more details. | |
13 | ||
14 | // You should have received a copy of the GNU General Public License along | |
15 | // with this library; see the file COPYING3. If not see | |
16 | // <http://www.gnu.org/licenses/>. | |
17 | ||
2b9c09a7 | 18 | // { dg-options "-O1 -g0" } |
71e09389 JW |
19 | // { dg-do compile { target c++11 } } |
20 | // { dg-final { scan-assembler-not "__throw_length_error" } } | |
21 | // { dg-final { scan-assembler-not "__throw_bad_alloc" } } | |
22 | ||
23 | #include <bits/c++config.h> | |
24 | #undef _GLIBCXX_EXTERN_TEMPLATE | |
25 | #include <string> | |
26 | ||
27 | void | |
28 | test01(std::string& target, std::string&& source) | |
29 | { | |
30 | // The move assignment operator should be simple enough that the compiler | |
31 | // can see that it never results in a length_error or bad_alloc exception | |
32 | // (which would be turned into std::terminate by the noexcept on the | |
5db78cac JW |
33 | // assignment operator). This is only true when inlining though. |
34 | #ifndef __NO_INLINE__ | |
71e09389 | 35 | target = std::move(source); |
5db78cac | 36 | #endif |
71e09389 | 37 | } |