2018-11-07 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / g++.dg / torture / pr60659.C
blobf0158a5220ad067b0bda95fe26917b632c31d0c8
1 // { dg-do compile }
2 template <typename _InputIterator> void __distance (_InputIterator);
3 template <typename _InputIterator>
4 void distance (_InputIterator, _InputIterator p2)
6   __distance (p2);
9 namespace boost
11 template <class Iterator> struct A
13   typedef typename Iterator::difference_type type;
15 template <class T> typename T::const_iterator end (T &);
16 template <class T> typename T::const_iterator begin (T &);
17 template <class T> struct D : A<typename T::const_iterator>
20 template <class T> typename D<T>::type distance (const T &p1)
22   distance (boost::begin (p1), boost::end (p1));
23   return 0;
25 template <class IteratorT> class B
27 public:
28   typedef B type;
29   typedef IteratorT const_iterator;
33 typedef int storage_t[];
34 struct F;
35 template <template <typename> class> struct G
37   G (const G &p1) { p1.m_fn1 ().m_fn1 (0); }
38   const F &m_fn1 () const
39   {
40     const void *a;
41     a = &data_m;
42     return *static_cast<const F *>(a);
43   }
44   storage_t *data_m;
47 struct F
49   virtual F *m_fn1 (void *) const;
51 template <typename> struct H;
52 struct C : G<H>
54   typedef int difference_type;
56 boost::B<C> AllTransVideos ();
57 int b = boost::distance (AllTransVideos ());