]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/testsuite/gdc.test/runnable/property.d
d: Import dmd b8384668f, druntime e6caaab9, phobos 5ab9ad256 (v2.098.0-beta.1)
[thirdparty/gcc.git] / gcc / testsuite / gdc.test / runnable / property.d
1
2
3 /******************************************/
4
5 struct Foo
6 {
7 int v;
8
9 int bar(int value) { return v = value + 2; }
10 int bar() { return 73; }
11 }
12
13 int test1()
14 {
15 Foo f;
16 int i;
17
18 i = (f.bar = 6);
19 assert(i == 8);
20 assert(f.v == 8);
21
22 i = f.bar;
23 assert(i == 73);
24
25 return 0;
26 }
27
28 /******************************************/
29 // https://issues.dlang.org/show_bug.cgi?id=6259
30
31 struct S6259
32 {
33 private int m_prop;
34 ref const(int) prop() return { return m_prop; }
35 void prop(int v) { m_prop = v; }
36 }
37
38 void test6259()
39 {
40 S6259 s;
41 s.prop = 1;
42 }
43
44 /******************************************/
45
46 void main()
47 {
48 test1();
49 test6259();
50 }