source: src/tests/ctorWarnings.c@ c8dfcd3

ADT aaron-thesis arm-eh ast-experimental cleanup-dtors ctor deferred_resn demangler enum forall-pointer-decay jacob/cs343-translation jenkins-sandbox new-ast new-ast-unique-expr new-env no_list persistent-indexer pthread-emulation qualifiedEnum resolv-new with_gc
Last change on this file since c8dfcd3 was 486341f, checked in by Rob Schluntz <rschlunt@…>, 9 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.