OSDN Git Service

* lib/lto.exp (lto_prune_vis_warns): Renamed to lto_prune_warns.
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / g++.dg / torture / pr34850.C
1 /* { dg-do compile } */
2 /* { dg-options "-O2" } */
3
4 typedef unsigned char uint8_t;
5 typedef unsigned int uint32_t;
6 typedef uint8_t byte;
7 typedef uint32_t u32bit;
8 __extension__ typedef __SIZE_TYPE__ size_t;
9 extern "C" {
10     extern void __warn_memset_zero_len (void) __attribute__((__warning__ ("")));
11     extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__gnu_inline__, __artificial__))
12     void * memset (void *__dest, int __ch, size_t __len) throw () {
13         if (__builtin_constant_p (__len) && __len == 0)
14             __warn_memset_zero_len (); /* { dg-warning "" } */
15     }
16 }
17 inline void clear_mem(void* ptr, u32bit n)    {
18     memset(ptr, 0, n);
19 }
20 template<typename T> class MemoryRegion    {
21 public:
22     u32bit size() const {
23     }
24     const T* begin() const {
25     }
26     void set(const T in[], u32bit n) {
27         create(n);
28     }
29     void set(const MemoryRegion<T>& in) {
30         set(in.begin(), in.size());
31     }
32     void clear() {
33         clear_mem(buf, allocated);
34     }
35     void create(u32bit);
36     MemoryRegion() {
37         used = allocated = 0;
38     }
39     mutable T* buf;
40     mutable u32bit used;
41     mutable u32bit allocated;
42 };
43 template<typename T> void MemoryRegion<T>::create(u32bit n)    {
44     if(n <= allocated) {
45         clear();
46     }
47 }
48 template<typename T> class SecureVector : public MemoryRegion<T>    {
49 public:
50     SecureVector<T>& operator=(const MemoryRegion<T>& in)          {
51         if(this != &in) set(in);
52     }
53 };
54 class OctetString    {
55 public:
56     SecureVector<byte> bits_of() const {
57     }
58     OctetString& operator^=(const OctetString&);
59     void change(const MemoryRegion<byte>& in) {
60         bits = in;
61     }
62     OctetString(const MemoryRegion<byte>& in) {
63         change(in);
64     }
65     SecureVector<byte> bits;
66 };
67 OctetString& OctetString::operator^=(const OctetString& k)    {
68     if(&k == this) {
69         bits.clear();
70     }
71 }
72 bool operator==(const OctetString& s1, const OctetString& s2)    {
73     return (s1.bits_of() == s2.bits_of());
74 }