Debian Codegraph @

libstdc++-v3/testsuite/17_intro/headers/c++1998/49745.cc

raw
1 // { dg-do compile { target *-*-linux* *-*-gnu* } }
2 // { dg-add-options no_pch }
3
4 // Copyright (C) 2011-2025 Free Software Foundation, Inc.
5 //
6 // This file is part of the GNU ISO C++ Library. This library is free
7 // software; you can redistribute it and/or modify it under the
8 // terms of the GNU General Public License as published by the
9 // Free Software Foundation; either version 3, or (at your option)
10 // any later version.
11
12 // This library is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
16
17 // You should have received a copy of the GNU General Public License along
18 // with this library; see the file COPYING3. If not see
19 // <http://www.gnu.org/licenses/>.
20
21 // libstdc++/49745
22 // error: 'int truncate' redeclared as different kind of symbol
23
24 // This tests that no libstdc++ headers include <unistd.h>.
25 // However, as discussed in PR libstdc++/100117 we cannot guarantee that
26 // no libc headers include it indirectly, so only include the C++ headers.
27 // That means we can't use <bits/stdc++.h> because that includes <cstdio> etc.
28 // so we list the C++ headers explicitly here. This list is unfortunately
29 // doomed to get out of date as new headers are added to the library.
30
31 #include <algorithm>
32 #include <bitset>
33 #include <complex>
34 #include <deque>
35 #include <exception>
36 #include <fstream>
37 #include <functional>
38 #include <iomanip>
39 #include <ios>
40 #include <iosfwd>
41 #include <iostream>
42 #include <istream>
43 #include <iterator>
44 #include <limits>
45 #include <list>
46 #include <locale>
47 #include <map>
48 #include <memory>
49 #include <new>
50 #include <numeric>
51 #include <ostream>
52 #include <queue>
53 #include <set>
54 #include <sstream>
55 #include <stack>
56 #include <stdexcept>
57 #include <streambuf>
58 #include <string>
59 #include <typeinfo>
60 #include <utility>
61 #include <valarray>
62 #include <vector>
63
64 #if __cplusplus >= 201103L
65 #include <array>
66 #include <atomic>
67 #include <chrono>
68 #include <codecvt>
69 #include <condition_variable>
70 #include <forward_list>
71 #include <future>
72 #include <initializer_list>
73 #include <mutex>
74 #include <random>
75 #include <ratio>
76 #include <regex>
77 #include <scoped_allocator>
78 #include <system_error>
79 #include <thread>
80 #include <tuple>
81 #include <typeindex>
82 #include <type_traits>
83 #include <unordered_map>
84 #include <unordered_set>
85 #endif
86
87 #if __cplusplus >= 201402L
88 #include <shared_mutex>
89 #endif
90
91 #if __cplusplus >= 201703L
92 #include <any>
93 #include <charconv>
94 // #include <execution>
95 #include <filesystem>
96 #include <optional>
97 #include <memory_resource>
98 #include <string_view>
99 #include <variant>
100 #endif
101
102 #if __cplusplus >= 202002L
103 #include <barrier>
104 #include <bit>
105 #include <compare>
106 #include <concepts>
107 #if __cpp_impl_coroutine
108 # include <coroutine>
109 #endif
110 #if __has_include (<format>)
111 # include <format>
112 #endif
113 #include <latch>
114 #include <numbers>
115 #include <ranges>
116 #include <span>
117 #include <stop_token>
118 #include <semaphore>
119 #include <source_location>
120 #include <syncstream>
121 #include <version>
122 #endif
123
124 #if __cplusplus > 202002L
125 #if __has_include(<spanstream>)
126 # include <spanstream>
127 #endif
128 #if __has_include(<stacktrace>)
129 # include <stacktrace>
130 #endif
131 #endif
132
133 int truncate = 0;
134
135 // { dg-xfail-if "PR libstdc++/99995" { c++20 } }