2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / gcc / testsuite / g++.old-deja / g++.bugs / 900519_09.C
blob71c42633450e37aba8a3a72c59b664e6953e6f94
1 // { dg-do assemble  }
2 // g++ 1.37.1 bug 900519_09
4 // g++ allows the allocation of const objects via operator new even when
5 // these uses of operator new do not include initializations.
7 // This is inconsistant within the restrictions placed on the construction
8 // of class, struct, and union types which have constant members.
10 // Since there is no completely valid way of initializing such objects
11 // after the invocation of new, these cases should all be illegal.
13 // keywords: operator new, initialization, const qualifier
15 struct struct_0 {
16   int member;
19 typedef const int const_int;
20 typedef const struct struct_0 const_struct_0;
22 void test ()
24   new const int;                // { dg-error "" } 
25   new const_int;                // { dg-error "" } 
26   new const struct_0;           // { dg-error "" } 
27   new const_struct_0;           // { dg-error "" } 
30 int main () { return 0; }