]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/testsuite/gdc.test/fail_compilation/disable_new.d
d: Import dmd b8384668f, druntime e6caaab9, phobos 5ab9ad256 (v2.098.0-beta.1)
[thirdparty/gcc.git] / gcc / testsuite / gdc.test / fail_compilation / disable_new.d
1 /*
2 TEST_OUTPUT:
3 ---
4 fail_compilation/disable_new.d(23): Error: cannot allocate `class C` with `new` because it is annotated with `@disable new()`
5 fail_compilation/disable_new.d(24): Error: cannot allocate `struct S` with `new` because it is annotated with `@disable new()`
6 ---
7 */
8
9 class C
10 {
11 // force user of a type to use an external allocation strategy
12 @disable new();
13 }
14
15 struct S
16 {
17 // force user of a type to use an external allocation strategy
18 @disable new();
19 }
20
21 void main()
22 {
23 auto c = new C();
24 auto s = new S();
25 }