3 // Copyright 2002 Free Software Foundation
4 // Contributed by Jason Merrill and Alexandre Oliva
6 // Test zero-initialization of pointers to data members. Their NULL
7 // value is represented with -1, not 0.
18 typedef int A::* iApm;
21 iApm gp_dflt = iApm();
22 iApm gp_cast = (iApm)0;
23 iApm gp_func = iApm(0);
24 iApm gp_stat = static_cast<iApm>(0);
28 int AD::* gp_impl = gp_dflt;
29 int AD::* gp_down = static_cast<int AD::*>(gp_stat);
33 // Test use in a simple struct.
46 // Test that in a class with a constructor, the pointer to member is
47 // zero-initialized until the constructor is run.
61 C::C() : mp (&A::i) { gd.count++; }
69 // The D must come first for this to work.
76 static int A::* sla[2];
79 if (gp != 0 || slp != 0
80 || gp_zero != 0 || gp_dflt != 0 || gp_cast != 0
81 || gp_func != 0 || gp_stat != 0
82 || gp_impl != 0 || gp_down != 0)
84 if (ga[1] != 0 || sla[1] != 0)
86 if (gb.mp != 0 || slb.mp != 0)