PR c++/37276
[official-gcc.git] / gcc / testsuite / g++.dg / torture / pr49938.C
blob91804f4b0d5f3eeecd0b3b90365525004cba897a
1 #include <vector>
2 #include <cstdlib>
3 typedef unsigned short uint16;
5 namespace base {
6     class StringPiece
7       {
8     public:
9         typedef std::size_t size_type;
10         size_type size() const { return length_; }
11         size_type length_;
12       };
15 namespace net {
16     class DNSSECKeySet
17       {
18         bool CheckSignature (const base::StringPiece& name, const
19                              base::StringPiece& zone, const
20                              base::StringPiece& signature, uint16 rrtype,
21                              const std::vector<base::StringPiece>& rrdatas);
22       };
25 template <class C> class scoped_array
27 public: typedef C element_type;
28         explicit scoped_array(C* p = __null):array_(p) {}
29 private:   C* array_;
32 namespace net {
33     bool DNSSECKeySet::CheckSignature (const base::StringPiece& name,
34                                        const base::StringPiece& zone, const base::StringPiece& signature,
35                                        uint16 rrtype, const std::vector<base::StringPiece>& rrdatas)
36       {
37         unsigned signed_data_len = 0;
38         for (std::vector<base::StringPiece>::const_iterator i =
39              rrdatas.begin();
40              i != rrdatas.end(); i++) {
41             signed_data_len += 2;
42             signed_data_len += i->size();
43         }
44         scoped_array<unsigned char> signed_data(new unsigned
45                                                 char[signed_data_len]);
46       }