http://gcc.gnu.org/ml/gcc-patches/2008-02/msg00110.html
[official-gcc.git] / gcc / testsuite / g++.dg / init / new18.C
blob45f6e7a095df452d8394c86bb60e85097776565d
1 // { dg-do compile }
2 // { dg-options "-O2 -fstrict-aliasing" }
4 // This caused an ICE during placement new.
6 namespace Pooma {
7    typedef int Context_t;
8    namespace Arch {
9    }
10    inline Context_t context() {
11   }
12    inline int contexts() {
13   }
14  }
15 template<class DomT, class T, class NewDom1T> struct DomainTraitsScalar {
16   };
17 template<class T> struct DomainTraits : public DomainTraitsScalar<T, T, T> {
18   };
19 template<int Dim> class Grid;
20 template<class DT> class DomainBase {
21   };
22 template<int Dim, class DT> class Domain : public DomainBase<DT> {
23   };
24 #include <vector>
25 template<> class Grid<1> : public Domain<1, DomainTraits<Grid<1> > > {
26   };
27 namespace Pooma {
28  class PatchSizeSyncer {
29     typedef Grid<1> Grid_t;
30     PatchSizeSyncer(int contextKey, Grid_t &localGrid);
31     int myContext_m;
32     int numContexts_m;
33     int localKey_m;
34     Grid_t localGrid_m;
35     typedef std::pair<int,Grid_t *> Elem_t;
36     std::vector<Elem_t> gridList_m;
37   };
38  }
39 namespace Pooma {
40  PatchSizeSyncer::PatchSizeSyncer(int contextKey, Grid_t &localGrid)   :
41 myContext_m(Pooma::context()),     numContexts_m(Pooma::contexts()),    
42 localKey_m(contextKey),     localGrid_m(localGrid) {
43     if (myContext_m == 0) gridList_m.reserve(numContexts_m);
44   }
45  }