]> git.ipfire.org Git - thirdparty/gcc.git/blame - libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_copy/808590-cxx11.cc
Update copyright years.
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / 20_util / specialized_algorithms / uninitialized_copy / 808590-cxx11.cc
CommitLineData
a945c346 1// Copyright (C) 2012-2024 Free Software Foundation, Inc.
793cac74
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
52066eae 18// { dg-do run { target c++11 } }
793cac74 19
52066eae 20// This is identical to ./808590.cc but for C++11 and later.
793cac74
JW
21// See https://gcc.gnu.org/ml/libstdc++/2014-05/msg00027.html
22
23#include <vector>
24#include <stdexcept>
25
26// 4.4.x only
27struct c
28{
29 void *m;
30
31 c(void* o = 0) : m(o) {}
32 c(const c &r) : m(r.m) {}
33
13feb023
JW
34 c& operator=(const c &) = default;
35
793cac74
JW
36 template<class T>
37 explicit c(T &o) : m((void*)0xdeadbeef) { }
38};
39
40int main()
41{
42 std::vector<c> cbs;
43 const c cb((void*)0xcafebabe);
44
45 for (int fd = 62; fd < 67; ++fd)
46 {
47 cbs.resize(fd + 1);
48 cbs[fd] = cb;
49 }
50
51 for (int fd = 62; fd< 67; ++fd)
52 if (cb.m != cbs[fd].m)
53 throw std::runtime_error("wrong");
54 return 0;
55}