2 // { dg-options "-frepo" }
3 // { dg-final { cleanup-repo-files } }
4 // { dg-require-host-local "" }
5 // { dg-skip-if "dkms are not final links" { vxworks_kernel } }
7 template <typename C> struct A
9 static void assign (C &c1, const C &c2) { c1 = c2; }
12 template <typename C, typename T> struct B
16 static const C terminal;
17 static unsigned long stor[];
18 static D &empty_rep ()
20 void *p = reinterpret_cast <void *>(&stor);
21 return *reinterpret_cast <D *>(p);
23 void test (unsigned long n)
25 T::assign (this->refdata ()[n], terminal);
27 C *refdata () throw ()
29 return reinterpret_cast <C *>(this + 1);
33 C *data () const { return dataplus; }
34 D *rep () const { return &((reinterpret_cast < D * >(data ()))[-1]); }
35 static D & empty_rep () { return D::empty_rep (); }
36 B () : dataplus (empty_rep ().refdata ()) { }
38 void push_back (C c) { rep ()->test (10); }
41 template <typename C, typename T> const C B <C, T>::D::terminal = C ();
42 template <typename C, typename T> unsigned long B <C, T>::D::stor[64];
47 B <char, A <char> > s;