2018-11-07 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / g++.dg / torture / pr57235.C
blob8a9e522a36ad54cb936a7fd688a99481e21f7967
1 // { dg-do compile }
2 // { dg-additional-options "-Wno-return-type" }
4 namespace std
6   template < class _Elem > struct char_traits
7   {
8   };
9   struct _Container_base
10   {
11   };
12     template < class _Ty > struct _Allocator_base
13   {
14   };
15     template < class _Ty > class allocator:public _Allocator_base < _Ty >
16   {
17   };
18   class _String_base:public _Container_base
19   {
20   };
21 template < class _Ty, class _Alloc > class _String_val:public _String_base
22   {
23   };
24 template < class _Elem, class _Traits, class _Ax > class basic_string:public _String_val < _Elem,
25     _Ax
26     >
27   {
28   public:typedef basic_string < _Elem, _Traits, _Ax > _Myt;
29     typedef _String_val < _Elem, _Ax > _Mybase;
30     basic_string (const _Elem * _Ptr):_Mybase ()
31     {
32     }
33   };
34   typedef basic_string < char, char_traits < char >,
35     allocator < char > >string;
39 namespace google
41   namespace protobuf
42   {
43     namespace internal
44     {
45       template < class C > class scoped_ptr
46       {
47       public:typedef C element_type;
48       explicit scoped_ptr (C * p = __null):ptr_ (p)
49         {
50         }
51          ~scoped_ptr ()
52         {
53           delete ptr_;
54         }
55         C *get () const
56         {
57           return ptr_;
58         }
59       private:  C * ptr_;
60       };
61     }
62     using internal::scoped_ptr;
63     enum LogLevel
64     {
65       LOGLEVEL_INFO, LOGLEVEL_WARNING, LOGLEVEL_ERROR, LOGLEVEL_FATAL,
66         LOGLEVEL_DFATAL = LOGLEVEL_ERROR
67     };
68     namespace internal
69     {
70       class LogMessage
71       {
72       public:LogMessage (LogLevel level, const char *filename,
73                     int line);
74          ~LogMessage ();
75           LogMessage & operator<< (const std::string & value);
76       };
77       class LogFinisher
78       {
79       public:void operator= (LogMessage & other);
80       };
81     }
82     using namespace std;
83     class Descriptor
84     {
85     };
86     class FieldDescriptor
87     {
88     public:
89       const Descriptor *message_type () const;
90       string DebugString () const;
91     };
92     class MessageLite
93     {
94     };
95     class Message:public MessageLite
96     {
97     public:inline Message ()
98       {
99       }
100       virtual ~ Message ();
101       virtual Message *New () const = 0;
102     };
103     class MessageFactory
104     {
105     };
106     class UnknownFieldSet
107     {
108     };
109     class DynamicMessageFactory:public MessageFactory
110     {
111     public:DynamicMessageFactory ();
112       const Message *GetPrototype (const Descriptor * type);
113     };
114     namespace io
115     {
116       class ErrorCollector
117       {
118       public:inline ErrorCollector ()
119         {
120         }
121         virtual ~ ErrorCollector ();
122       };
123     }
124     class DescriptorBuilder
125     {
126       class OptionInterpreter
127       {
128         bool SetAggregateOption (const FieldDescriptor * option_field,
129                                  UnknownFieldSet * unknown_fields);
130         DynamicMessageFactory dynamic_factory_;
131       };
132     };
133     namespace
134     {
135       class AggregateErrorCollector:public io::ErrorCollector
136       {
137       };
138     }
139     bool DescriptorBuilder::OptionInterpreter::
140       SetAggregateOption (const FieldDescriptor * option_field,
141                           UnknownFieldSet * unknown_fields)
142     {
143       const Descriptor *type = option_field->message_type ();
144       scoped_ptr < Message >
145         dynamic (dynamic_factory_.GetPrototype (type)->New ());
146       !(!(dynamic.get () !=
147           __null)) ? (void) 0 : ::google::protobuf::internal::
148         LogFinisher () =::google::protobuf::internal::LogMessage (::google::
149                                                                   protobuf::
150                                                                   LOGLEVEL_FATAL,
151                                                                   "descriptor.cc",
152                                                                   4396) <<
153         option_field->DebugString ();
154       AggregateErrorCollector collector;
155     }
156   }