Debian Codegraph @

libstdc++-v3/testsuite/23_containers/vector/capacity/114945.cc

raw
1 // { dg-options "-O2 -Werror=stringop-overflow -Werror=array-bounds" }
2 // { dg-do compile { target c++11 } }
3
4 // Bug libstdc++/114945
5 // Sporadic std::vector::resize() -Wstringop-overflow or -Warray-bounds warning
6
7 #include <stdint.h>
8 #include <vector>
9 template <typename a> struct b {
10 void resize(std::size_t c) { d.resize(c); }
11 template <typename e> void f(a, e);
12 std::vector<char> d;
13 };
14 #include <regex>
15 std::regex g;
16 uint64_t h;
17 uint32_t i;
18 struct s {
19 enum class j : size_t;
20 void k();
21 using l = b<j>;
22 std::vector<l> m;
23 };
24 enum class s::j : size_t { n };
25 void o() { g = ""; }
26 void s::k() {
27 l p;
28 auto q = uint32_t(), r = uint32_t();
29 if (h)
30 r = i;
31 b<size_t> t;
32 if (q || r)
33 p.f(j::n, 5);
34 t.resize(4);
35 m.push_back(p);
36 }