1 // { dg-do assemble }
2 // g++ 1.37.1 bug 900519_09
3
4 // g++ allows the allocation of const objects via operator new even when
5 // these uses of operator new do not include initializations.
6
7 // This is inconsistant within the restrictions placed on the construction
8 // of class, struct, and union types which have constant members.
9
10 // Since there is no completely valid way of initializing such objects
11 // after the invocation of new, these cases should all be illegal.
12
13 // keywords: operator new, initialization, const qualifier
14
15 struct struct_0 {
16 int member;
17 };
18
19 typedef const int const_int;
20 typedef const struct struct_0 const_struct_0;
21
test()22 void test ()
23 {
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 "" }
28 }
29
main()30 int main () { return 0; }
31