OSDN Git Service

PR c++/53549
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / g++.dg / torture / pr46383.C
1 // { dg-do compile }
2
3 namespace std {
4 template<class,class>struct pair{};
5   template<typename _Tp> struct _Vector_base {
6       struct _Vector_impl
7       {
8         _Tp* _M_start;
9         _Tp* _M_finish;
10         _Tp* _M_end_of_storage;
11       };
12       _Vector_impl _M_impl;
13     };
14   template<typename _Tp >
15     struct vector : _Vector_base<_Tp>
16     {
17       vector(const vector& __x);
18     };
19 }
20 namespace boost {
21 struct G{};
22 template <class T, class U >
23 struct modable2
24 : G
25 { };
26 }
27 namespace CGAL {
28 struct Rep { };
29 struct Handle
30 {
31     Handle() ;
32     Handle(const Handle& x) ;
33     Rep* PTR;
34 };
35 template <typename ET_> class Lazy_exact_nt
36   : Handle
37   , boost::modable2< Lazy_exact_nt<ET_>, int >
38   , boost::modable2< Lazy_exact_nt<ET_>, double >
39 { };
40   struct CC_iterator { };
41 struct Triangulation_data_structure_3 {
42   typedef CC_iterator                          Vertex_handle;
43   typedef CC_iterator                            Cell_handle;
44   typedef std::pair<Cell_handle, int>              Facet;
45 };
46 template < class GT, class Tds_ > struct Triangulation_3 {
47   typedef Tds_                                  Tds;
48   typedef typename GT::Point_3                 Point;
49   typedef typename Tds::Facet                  Facet;
50   typedef typename Tds::Vertex_handle          Vertex_handle;
51   enum Locate_type { VERTEX=0, EDGE, FACET, CELL, OUTSIDE_CONVEX_HULL, OUTSIDE_AFFINE_HULL };
52   Tds _tds;
53   bool is_infinite(const Facet & f) const ;
54 };
55 template < class Gt, class Tds_ > struct Delaunay_triangulation_3 : public Triangulation_3<Gt, Tds_> { };
56   namespace Surface_mesher { enum Verbose_flag { VERBOSE, NOT_VERBOSE }; }
57 enum Mesher_level_conflict_status { NO_CONFLICT = 0, CONFLICT_BUT_ELEMENT_CAN_BE_RECONSIDERED, CONFLICT_AND_ELEMENT_SHOULD_BE_DROPPED };
58 struct Null_mesher_level {
59   template <typename P, typename Z> Mesher_level_conflict_status test_point_conflict_from_superior(P, Z) ;
60 };
61 template < class Tr, class Derived, class Element, class Previous, class Triangulation_traits > struct Mesher_level {
62   typedef Tr Triangulation;
63   typedef typename Triangulation::Point Point;
64   typedef typename Triangulation::Vertex_handle Vertex_handle;
65   typedef typename Triangulation_traits::Zone Zone;
66   typedef Previous Previous_level;
67   Derived& derived() { return static_cast<Derived&>(*this); }
68   Previous& previous_level;
69   Mesher_level(Previous_level& previous)
70     : previous_level(previous)
71   { }
72   Vertex_handle insert(Point p, Zone& z) ;
73   Zone conflicts_zone(const Point& p, Element e) ;
74   Element get_next_element() ;
75   template <class Mesh_visitor> void before_insertion(Element& e, const Point& p, Zone& zone, Mesh_visitor visitor) {
76     visitor.before_insertion(e, p, zone);
77   }
78   template <class Mesh_visitor> void after_insertion(Vertex_handle vh, Mesh_visitor visitor) {
79     derived().after_insertion_impl(vh);
80   }
81   template <class Mesh_visitor> void after_no_insertion(const Element& e, const Point& p, Zone& zone, Mesh_visitor visitor) {
82     visitor.after_no_insertion(e, p, zone);
83   }
84   template <class Mesh_visitor> void refine(Mesh_visitor visitor)
85   {
86     Element e = get_next_element();
87     const Mesher_level_conflict_status result = try_to_refine_element(e, visitor);
88   }
89   template <class Mesh_visitor> Mesher_level_conflict_status try_to_refine_element(Element e, Mesh_visitor visitor)
90   {
91     Point p ;
92     Zone zone = conflicts_zone(p, e);
93     const Mesher_level_conflict_status result = test_point_conflict(p, zone);
94       before_insertion(e, p, zone, visitor);
95       Vertex_handle v = insert(p, zone);
96       after_insertion(v, visitor);
97       after_no_insertion(e, p, zone, visitor);
98   }
99   Mesher_level_conflict_status test_point_conflict(const Point& p, Zone& zone)
100   {
101     return previous_level.test_point_conflict_from_superior(p, zone);
102   }
103 };
104 struct Null_mesh_visitor {
105   template <typename E, typename P, typename Z> void before_insertion(E, P, Z) const {}
106   template <typename E, typename P, typename Z> void after_no_insertion(E, P, Z) const {}
107 };
108 template <class Tr> struct Triangulation_ref_impl {
109   Triangulation_ref_impl(Tr& t);
110 };
111 template <typename Tr> struct Triangulation_mesher_level_traits_3
112 : public Triangulation_ref_impl<Tr>
113 {
114   typedef typename Tr::Facet Facet;
115   Triangulation_mesher_level_traits_3(Tr& t)
116     : Triangulation_ref_impl<Tr>(t)
117   { }
118   struct Zone {
119     typedef std::vector<int*> Cells;
120     typedef std::vector<Facet> Facets;
121     typedef typename Tr::Locate_type Locate_type;
122     Locate_type locate_type;
123     Cells cells;
124     Facets boundary_facets;
125     Facets internal_facets;
126   };
127 };
128   namespace Surface_mesher {
129     namespace details {
130       template <typename Base> struct Triangulation_generator {
131         typedef typename Base::Complex_2_in_triangulation_3 C2T3;
132         typedef typename C2T3::Triangulation Triangulation;
133         typedef Triangulation Type;
134         typedef Type type;
135       };
136       template <typename Base> struct Facet_generator {
137         typedef typename Triangulation_generator<Base>::type Tr;
138         typedef typename Tr::Facet Type;
139         typedef Type type;
140       };
141       template <typename Base, typename Self, typename Element, typename PreviousLevel = Null_mesher_level> struct Mesher_level_generator {
142         typedef typename Base::Complex_2_in_triangulation_3 C2T3;
143         typedef typename C2T3::Triangulation Triangulation;
144         typedef Triangulation_mesher_level_traits_3<Triangulation> Tr_m_l_traits_3;
145         typedef Mesher_level <Triangulation, Self, Element, PreviousLevel, Tr_m_l_traits_3> Type;
146       };
147     }
148   template < class C2T3, class Surface_, class SurfaceMeshTraits, class Criteria_ > struct Surface_mesher_base
149     : public Triangulation_mesher_level_traits_3<typename C2T3::Triangulation>
150   {
151     typedef C2T3 Complex_2_in_triangulation_3;
152     typedef Surface_ Surface;
153     typedef SurfaceMeshTraits Surface_mesh_traits;
154     typedef Criteria_ Criteria;
155     typedef typename C2T3::Triangulation Tr;
156     typedef typename Tr::Vertex_handle Vertex_handle;
157     typedef typename Tr::Facet Facet;
158     Surface_mesher_base (C2T3& co, const Surface& s, const Surface_mesh_traits& mesh_traits, const Criteria& c)
159 : Triangulation_mesher_level_traits_3<Tr>(co.triangulation()), c2t3(co), tr(co.triangulation()), surf(s), meshtraits(mesh_traits), criteria(c)
160     { }
161     C2T3& c2t3;
162     Tr& tr;
163     const Surface& surf;
164     const Surface_mesh_traits& meshtraits;
165     const Criteria& criteria;
166     void after_insertion_impl(const Vertex_handle& v) {
167         after_insertion_handle_opposite_facet (Facet ());
168         after_insertion_handle_incident_facet (Facet ());
169     }
170     void after_insertion_handle_incident_facet (const Facet& f) {
171       tr.is_infinite(f) ;
172       new_facet<false>(f);
173     }
174     template <bool remove_from_complex_if_not_in_restricted_Delaunay> void new_facet (const Facet& f) ;
175     void after_insertion_handle_opposite_facet (const Facet& f) {
176       after_insertion_handle_incident_facet (f);
177     }
178   };
179   template < typename Base, typename Element = typename details::Facet_generator<Base>::type, typename PreviousLevel = Null_mesher_level, Verbose_flag verbose = NOT_VERBOSE > struct Surface_mesher
180     : public Base , public details::Mesher_level_generator< Base, Surface_mesher<Base, Element, PreviousLevel, verbose>, Element, PreviousLevel >::Type
181   {
182     typedef typename Base::Complex_2_in_triangulation_3 C2T3;
183     typedef typename Base::Surface Surface;
184     typedef typename Base::Criteria Criteria;
185     typedef typename Base::Surface_mesh_traits Surface_mesh_traits;
186     typedef typename details::Mesher_level_generator< Base, Surface_mesher<Base, Element, PreviousLevel, verbose>, Element, PreviousLevel >::Type Mesher_lvl;
187     using Mesher_lvl::refine;
188     Null_mesher_level null_mesher_level;
189     Null_mesh_visitor null_visitor;
190     bool initialized;
191     Surface_mesher(C2T3& c2t3, const Surface& surface, const Surface_mesh_traits& mesh_traits, const Criteria& criteria)
192       : Base(c2t3, surface, mesh_traits, criteria), Mesher_lvl(null_mesher_level), initialized(false)
193     { }
194     void refine_mesh () {
195       refine(null_visitor);
196     }
197   };
198   }
199 template <typename Surface> struct Surface_mesh_traits_generator_3 {
200   typedef typename Surface::Surface_mesher_traits_3 Type;
201   typedef Type type;
202 };
203 template < class Tr, typename Edge_info_ = void > struct Complex_2_in_triangulation_3 {
204   typedef Tr Triangulation;
205   Triangulation& triangulation();
206 };
207 template <class Tr> struct Surface_mesh_complex_2_in_triangulation_3
208 : public Complex_2_in_triangulation_3<Tr>
209 { };
210   struct Non_manifold_tag {};
211   template < typename C2T3, typename SurfaceMeshTraits_3, typename Criteria, typename Tag > struct Make_surface_mesh_helper {
212     typedef Surface_mesher::Surface_mesher_base< C2T3, typename SurfaceMeshTraits_3::Surface_3, SurfaceMeshTraits_3, Criteria> Mesher_base;
213   };
214   template <typename C2T3, typename SurfaceMeshTraits_3, typename Criteria, typename Tag, Surface_mesher::Verbose_flag verbosity = Surface_mesher::NOT_VERBOSE > struct Surface_mesher_generator {
215     typedef typename Make_surface_mesh_helper< C2T3, SurfaceMeshTraits_3, Criteria, Tag>::Mesher_base Mesher_base;
216     typedef Surface_mesher::Surface_mesher< Mesher_base, typename Surface_mesher::details::Facet_generator<Mesher_base>::type, Null_mesher_level, verbosity> Mesher;
217     typedef Mesher type;
218   };
219 template <typename C2T3, typename SurfaceMeshTraits_3, typename Criteria> void make_surface_mesh(C2T3& c2t3, const typename SurfaceMeshTraits_3::Surface_3& surface, const SurfaceMeshTraits_3& surface_mesh_traits, const Criteria& criteria) {
220   typedef typename Surface_mesher_generator< C2T3, SurfaceMeshTraits_3, Criteria, Non_manifold_tag, Surface_mesher::NOT_VERBOSE >::type Mesher;
221   Mesher mesher(c2t3, surface, surface_mesh_traits, criteria);
222   mesher.refine_mesh();
223 }
224 template <class Kernel> struct Surface_mesh_triangulation_generator_3 {
225   typedef CGAL::Triangulation_data_structure_3 Tds;
226   typedef CGAL::Delaunay_triangulation_3<Kernel, Tds> Type;
227 };
228   namespace Surface_mesher {
229   namespace { struct Return_min { }; }
230   template < class GT, class Surface, class Unused = Return_min > struct Implicit_surface_oracle_3 {
231     typedef Surface Surface_3;
232   };
233   }
234   template< typename GT> struct Implicit_surface_3 {
235     typedef GT Geom_traits;
236     typedef Implicit_surface_3<Geom_traits > Self;
237     typedef Surface_mesher::Implicit_surface_oracle_3< Geom_traits, Self> Surface_mesher_traits_3;
238   };
239 }
240 struct K {
241 struct Point_3 {
242 CGAL::Lazy_exact_nt<double> a[3];
243 };
244 };
245 typedef CGAL::Surface_mesh_triangulation_generator_3<K>::Type Tr;
246 typedef CGAL::Surface_mesh_complex_2_in_triangulation_3<Tr> C2T3;
247 typedef CGAL::Implicit_surface_3<K > Surface;
248 typedef CGAL::Surface_mesh_traits_generator_3<Surface>::type Traits;
249 void f() {
250         C2T3 c2t3 ;
251         CGAL::make_surface_mesh(c2t3, Surface(), Traits(), 3);
252 }