OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.dg/] [template/] [repo9.C] - Blame information for rev 693

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 693 jeremybenn
// PR c++/36364
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 } }
6
 
7
template  struct A
8
{
9
  static void assign (C &c1, const C &c2) { c1 = c2; }
10
};
11
 
12
template  struct B
13
{
14
  struct D
15
  {
16
    static const C terminal;
17
    static unsigned long stor[];
18
    static D &empty_rep ()
19
    {
20
      void *p = reinterpret_cast (&stor);
21
      return *reinterpret_cast (p);
22
    }
23
    void test (unsigned long n)
24
    {
25
      T::assign (this->refdata ()[n], terminal);
26
    }
27
    C *refdata () throw ()
28
    {
29
      return reinterpret_cast (this + 1);
30
    }
31
  };
32
  C *dataplus;
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 ()) { }
37
  ~B () { }
38
  void push_back (C c) { rep ()->test (10); }
39
};
40
 
41
template  const C B ::D::terminal = C ();
42
template  unsigned long B ::D::stor[64];
43
 
44
int
45
main ()
46
{
47
  B  > s;
48
  s.push_back ('a');
49
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.