aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.pt/union2.C
blob: f064e4ecefd99f169fbbdf4b01229aecbc5c1520 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// Build don't link:
// Origin: David Mazieres <dm@amsterdam.lcs.mit.edu>

template<class T> struct vector_base {
  typedef T elm_t;
protected:
  union {
    double alignment_hack;
    char defbuf_space[2 * sizeof (elm_t)];
  };
  elm_t *def_basep () { return reinterpret_cast<elm_t *> (defbuf_space); }
};

template<class T> struct vector : public vector_base<T> {
  vector () { def_basep (); }
};

vector<int> iv;