source: src/tests/ctorWarnings.c @ 486341f

ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsctordeferred_resndemanglerenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprnew-envno_listpersistent-indexerpthread-emulationqualifiedEnumresolv-newwith_gc
Last change on this file since 486341f was 486341f, checked in by Rob Schluntz <rschlunt@…>, 8 years ago

add option to CodeGen? to output unmangled name, add ctorWarnings test

  • Property mode set to 100644
File size: 411 bytes
Line 
1struct A {
2  int x, y, z;
3};
4
5void ?{}(A * a, int x) {
6  (&a->x){ x+999 };
7  a->y = 0; // not technically a constructor, but okay
8} // z never constructed
9
10struct B {
11  A a1, a2, a3;
12};
13
14void ?{}(B * b) {
15  b->a2 = (A) { 2 }; // a2 used before constructed
16  (&b->a1){ 1 };
17} // a2, a3 never constructed
18
19void ^?{}(B * b) {
20  b->a2 = (A) { 0 };
21  ^(&b->a1){};
22} // a2, a3 never destructed
23
24int main() {
25  B b;
26}
Note: See TracBrowser for help on using the repository browser.