Changeset a42a654 for tests/raii


Ignore:
Timestamp:
Aug 28, 2018, 6:30:11 PM (6 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
ADT, arm-eh, ast-experimental, cleanup-dtors, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
f8b69da7
Parents:
b54ad9c
Message:

Update memberCtors test to add more information

Location:
tests/raii
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • tests/raii/.expect/memberCtors-ERR1.txt

    rb54ad9c ra42a654  
    1 raii/memberCtors.c:71:1 error: in void ?{}(B &b), field a2 used before being constructed
     1raii/memberCtors.c:92:1 error: in void ?{}(B &b), field a2 used before being constructed
  • tests/raii/.expect/memberCtors.txt

    rb54ad9c ra42a654  
    11Before declaration of b1
    2 constructing int
    3 constructing int
    4 constructing int
    5 constructing int
    6 constructing int
    7 constructing int
    8 begin construct B
     2constructing int id: 0
     3constructing int id: 1
     4constructing int id: 2
     5default construct A 0
     6constructing int id: 3
     7constructing int id: 4
     8constructing int id: 5
     9default construct A 1
     10begin construct B id: 0
    911assign b.a2
    10 constructing int
    11 constructing int
    12 begin construct A
    13 construct a.x
    14 constructing int: 1001
    15 assign a.y
    16 assigning int: 0 0
    17 end construct A
    18 copy constructing int: 0
    19 copy constructing int: 0
    20 begin copy construct A
    21 copy construct this.x
    22 copy constructing int: 1001
    23 assign this.y
    24 copy constructing int: 0
    25 destructing int: 0
    26 destructing int: 0
    27 end copy construct A
    28 begin ?=? A
    29 copy constructing int: 1001
    30 destructing int: 1001
    31 destructing int: 1001
    32 copy constructing int: 0
    33 destructing int: 0
    34 destructing int: 0
    35 copy constructing int: 0
    36 destructing int: 0
    37 destructing int: 0
     12constructing int id: 6
     13constructing int id: 7
     14begin construct A id: 2
     15construct a.x
     16constructing int: 1001 id: 8
     17assign a.y
     18assigning int: 0 0 id: 6
     19end construct A
     20copy constructing int: 0 id: 9
     21copy constructing int: 0 id: 10
     22begin copy construct A id: 3
     23copy construct this.x
     24copy constructing int: 1001 id: 11
     25assign this.y
     26copy constructing int: 0 id: 12
     27destructing int: 0 id: 12
     28destructing int: 0 id: 12
     29end copy construct A
     30begin ?=? A id: 0
     31copy constructing int: 1001 id: 13
     32destructing int: 1001 id: 13
     33destructing int: 1001 id: 13
     34copy constructing int: 0 id: 14
     35destructing int: 0 id: 14
     36destructing int: 0 id: 14
     37copy constructing int: 0 id: 15
     38destructing int: 0 id: 15
     39destructing int: 0 id: 15
    3840end ?=? A
    39 copy constructing int: 0
    40 copy constructing int: 0
    41 begin copy construct A
    42 copy construct this.x
    43 copy constructing int: 1001
    44 assign this.y
    45 copy constructing int: 0
    46 destructing int: 0
    47 destructing int: 0
    48 end copy construct A
    49 destructing int: 0
    50 destructing int: 0
    51 destructing int: 1001
    52 destructing int: 0
    53 destructing int: 0
    54 destructing int: 1001
     41copy constructing int: 0 id: 16
     42copy constructing int: 0 id: 17
     43begin copy construct A id: 4
     44copy construct this.x
     45copy constructing int: 1001 id: 18
     46assign this.y
     47copy constructing int: 0 id: 19
     48destructing int: 0 id: 19
     49destructing int: 0 id: 19
     50end copy construct A
     51destructing int: 0 id: 17
     52destructing int: 0 id: 19
     53destructing int: 1001 id: 18
     54destructing int: 0 id: 10
     55destructing int: 0 id: 12
     56destructing int: 1001 id: 11
    5557construct b.a1
    56 constructing int
    57 constructing int
    58 begin construct A
    59 construct a.x
    60 constructing int: 1000
    61 assign a.y
    62 assigning int: 0 0
     58constructing int id: 20
     59constructing int id: 21
     60begin construct A id: 5
     61construct a.x
     62constructing int: 1000 id: 22
     63assign a.y
     64assigning int: 0 0 id: 20
    6365end construct A
    6466end construct B
    65 destructing int: 0
    66 destructing int: 0
    67 destructing int: 1001
     67destructing int: 0 id: 7
     68destructing int: 0 id: 6
     69destructing int: 1001 id: 8
    6870Before declaration of b2
    69 copy constructing int: 0
    70 copy constructing int: 0
    71 begin copy construct A
    72 copy construct this.x
    73 copy constructing int: 1000
    74 assign this.y
    75 copy constructing int: 0
    76 destructing int: 0
    77 destructing int: 0
    78 end copy construct A
    79 copy constructing int: 0
    80 copy constructing int: 0
    81 begin copy construct A
    82 copy construct this.x
    83 copy constructing int: 1001
    84 assign this.y
    85 copy constructing int: 0
    86 destructing int: 0
    87 destructing int: 0
    88 end copy construct A
    89 copy constructing int: 0
    90 copy constructing int: 0
    91 begin copy construct A
    92 copy construct this.x
    93 copy constructing int: 0
    94 assign this.y
    95 copy constructing int: 0
    96 destructing int: 0
    97 destructing int: 0
     71copy constructing int: 0 id: 23
     72copy constructing int: 0 id: 24
     73begin copy construct A id: 6
     74copy construct this.x
     75copy constructing int: 1000 id: 25
     76assign this.y
     77copy constructing int: 0 id: 26
     78destructing int: 0 id: 26
     79destructing int: 0 id: 26
     80end copy construct A
     81copy constructing int: 0 id: 27
     82copy constructing int: 0 id: 28
     83begin copy construct A id: 7
     84copy construct this.x
     85copy constructing int: 1001 id: 29
     86assign this.y
     87copy constructing int: 0 id: 30
     88destructing int: 0 id: 30
     89destructing int: 0 id: 30
     90end copy construct A
     91copy constructing int: 0 id: 31
     92copy constructing int: 0 id: 32
     93begin copy construct A id: 8
     94copy construct this.x
     95copy constructing int: 0 id: 33
     96assign this.y
     97copy constructing int: 0 id: 34
     98destructing int: 0 id: 34
     99destructing int: 0 id: 34
    98100end copy construct A
    99101End of main
    100 begin destruct B
    101 constructing int
    102 constructing int
    103 begin construct A
    104 construct a.x
    105 constructing int: 999
    106 assign a.y
    107 assigning int: 0 0
    108 end construct A
    109 copy constructing int: 0
    110 copy constructing int: 0
    111 begin copy construct A
    112 copy construct this.x
    113 copy constructing int: 999
    114 assign this.y
    115 copy constructing int: 0
    116 destructing int: 0
    117 destructing int: 0
    118 end copy construct A
    119 begin ?=? A
    120 copy constructing int: 999
    121 destructing int: 999
    122 destructing int: 999
    123 copy constructing int: 0
    124 destructing int: 0
    125 destructing int: 0
    126 copy constructing int: 0
    127 destructing int: 0
    128 destructing int: 0
     102begin destruct B id: 1
     103constructing int id: 35
     104constructing int id: 36
     105begin construct A id: 9
     106construct a.x
     107constructing int: 999 id: 37
     108assign a.y
     109assigning int: 0 0 id: 35
     110end construct A
     111copy constructing int: 0 id: 38
     112copy constructing int: 0 id: 39
     113begin copy construct A id: 10
     114copy construct this.x
     115copy constructing int: 999 id: 40
     116assign this.y
     117copy constructing int: 0 id: 41
     118destructing int: 0 id: 41
     119destructing int: 0 id: 41
     120end copy construct A
     121begin ?=? A id: 7
     122copy constructing int: 999 id: 42
     123destructing int: 999 id: 42
     124destructing int: 999 id: 42
     125copy constructing int: 0 id: 43
     126destructing int: 0 id: 43
     127destructing int: 0 id: 43
     128copy constructing int: 0 id: 44
     129destructing int: 0 id: 44
     130destructing int: 0 id: 44
    129131end ?=? A
    130 copy constructing int: 0
    131 copy constructing int: 0
    132 begin copy construct A
    133 copy construct this.x
    134 copy constructing int: 999
    135 assign this.y
    136 copy constructing int: 0
    137 destructing int: 0
    138 destructing int: 0
    139 end copy construct A
    140 destructing int: 0
    141 destructing int: 0
    142 destructing int: 999
    143 destructing int: 0
    144 destructing int: 0
    145 destructing int: 999
    146 destructing int: 0
    147 destructing int: 0
    148 destructing int: 1000
     132copy constructing int: 0 id: 45
     133copy constructing int: 0 id: 46
     134begin copy construct A id: 11
     135copy construct this.x
     136copy constructing int: 999 id: 47
     137assign this.y
     138copy constructing int: 0 id: 48
     139destructing int: 0 id: 48
     140destructing int: 0 id: 48
     141end copy construct A
     142destructing int: 0 id: 46
     143destructing int: 0 id: 48
     144destructing int: 999 id: 47
     145destructing int: 0 id: 39
     146destructing int: 0 id: 41
     147destructing int: 999 id: 40
     148destructing int: 0 id: 24
     149destructing int: 0 id: 26
     150destructing int: 1000 id: 25
    149151end destruct B
    150 destructing int: 0
    151 destructing int: 0
    152 destructing int: 999
    153 destructing int: 0
    154 destructing int: 0
    155 destructing int: 0
    156 destructing int: 0
    157 destructing int: 0
    158 destructing int: 999
    159 begin destruct B
    160 constructing int
    161 constructing int
    162 begin construct A
    163 construct a.x
    164 constructing int: 999
    165 assign a.y
    166 assigning int: 0 0
    167 end construct A
    168 copy constructing int: 0
    169 copy constructing int: 0
    170 begin copy construct A
    171 copy construct this.x
    172 copy constructing int: 999
    173 assign this.y
    174 copy constructing int: 0
    175 destructing int: 0
    176 destructing int: 0
    177 end copy construct A
    178 begin ?=? A
    179 copy constructing int: 999
    180 destructing int: 999
    181 destructing int: 999
    182 copy constructing int: 0
    183 destructing int: 0
    184 destructing int: 0
    185 copy constructing int: 0
    186 destructing int: 0
    187 destructing int: 0
     152destructing int: 0 id: 36
     153destructing int: 0 id: 35
     154destructing int: 999 id: 37
     155destructing int: 0 id: 32
     156destructing int: 0 id: 34
     157destructing int: 0 id: 33
     158destructing int: 0 id: 44
     159destructing int: 0 id: 43
     160destructing int: 999 id: 42
     161begin destruct B id: 2
     162constructing int id: 49
     163constructing int id: 50
     164begin construct A id: 12
     165construct a.x
     166constructing int: 999 id: 51
     167assign a.y
     168assigning int: 0 0 id: 49
     169end construct A
     170copy constructing int: 0 id: 52
     171copy constructing int: 0 id: 53
     172begin copy construct A id: 13
     173copy construct this.x
     174copy constructing int: 999 id: 54
     175assign this.y
     176copy constructing int: 0 id: 55
     177destructing int: 0 id: 55
     178destructing int: 0 id: 55
     179end copy construct A
     180begin ?=? A id: 0
     181copy constructing int: 999 id: 56
     182destructing int: 999 id: 56
     183destructing int: 999 id: 56
     184copy constructing int: 0 id: 57
     185destructing int: 0 id: 57
     186destructing int: 0 id: 57
     187copy constructing int: 0 id: 58
     188destructing int: 0 id: 58
     189destructing int: 0 id: 58
    188190end ?=? A
    189 copy constructing int: 0
    190 copy constructing int: 0
    191 begin copy construct A
    192 copy construct this.x
    193 copy constructing int: 999
    194 assign this.y
    195 copy constructing int: 0
    196 destructing int: 0
    197 destructing int: 0
    198 end copy construct A
    199 destructing int: 0
    200 destructing int: 0
    201 destructing int: 999
    202 destructing int: 0
    203 destructing int: 0
    204 destructing int: 999
    205 destructing int: 0
    206 destructing int: 0
    207 destructing int: 1000
     191copy constructing int: 0 id: 59
     192copy constructing int: 0 id: 60
     193begin copy construct A id: 14
     194copy construct this.x
     195copy constructing int: 999 id: 61
     196assign this.y
     197copy constructing int: 0 id: 62
     198destructing int: 0 id: 62
     199destructing int: 0 id: 62
     200end copy construct A
     201destructing int: 0 id: 60
     202destructing int: 0 id: 62
     203destructing int: 999 id: 61
     204destructing int: 0 id: 53
     205destructing int: 0 id: 55
     206destructing int: 999 id: 54
     207destructing int: 0 id: 21
     208destructing int: 0 id: 20
     209destructing int: 1000 id: 22
    208210end destruct B
    209 destructing int: 0
    210 destructing int: 0
    211 destructing int: 999
    212 destructing int: 0
    213 destructing int: 0
    214 destructing int: 0
    215 destructing int: 0
    216 destructing int: 0
    217 destructing int: 999
     211destructing int: 0 id: 50
     212destructing int: 0 id: 49
     213destructing int: 999 id: 51
     214destructing int: 0 id: 5
     215destructing int: 0 id: 4
     216destructing int: 0 id: 3
     217destructing int: 0 id: 58
     218destructing int: 0 id: 57
     219destructing int: 999 id: 56
  • tests/raii/memberCtors.c

    rb54ad9c ra42a654  
    11struct WrappedInt {
    22  int x;
     3  int id;
    34};
     5int intID = 0;
    46
    57void ?{}(WrappedInt & this) {
    6   printf("constructing int\n");
     8  this.id = intID++;
     9  printf("constructing int id: %d\n", this.id);
    710  this.x = 0;
    811}
    912
    1013void ?{}(WrappedInt & this, WrappedInt other) {
    11   printf("copy constructing int: %d\n", other.x);
     14  this.id = intID++;
     15  printf("copy constructing int: %d id: %d\n", other.x, this.id);
    1216  this.x = other.x;
    1317}
    1418
    1519void ?{}(WrappedInt & this, int x) {
    16   printf("constructing int: %d\n", x);
     20  this.id = intID++;
     21  printf("constructing int: %d id: %d\n", x, this.id);
    1722  this.x = x;
    1823}
    1924
    2025void ^?{}(WrappedInt & this) {
    21   printf("destructing int: %d\n", this.x);
     26  printf("destructing int: %d id: %d\n", this.x, this.id);
    2227}
    2328
    2429/* WrappedInt */ void ?=?(WrappedInt & this, int x) {
    25   printf("assigning int: %d %d\n", this.x, x);
     30  printf("assigning int: %d %d id: %d\n", this.x, x, this.id);
    2631  this.x = x;
    2732  // return this;
     
    3641struct A {
    3742  WrappedInt x, y, z;
     43  int id;
    3844};
     45int AID = 0;
    3946
    4047void ?{}(A & a) {
    4148  // currently must define default ctor, since there's no "= default" syntax
     49  a.id = AID++;
     50  printf("default construct A %d\n", a.id);
    4251}
    4352
    4453void ?{}(A & a, int x) {
    45   printf("begin construct A\n");
     54  a.id = AID++;
     55  printf("begin construct A id: %d\n", a.id);
    4656  printf("construct a.x\n");
    4757  (a.x){ x+999 };
     
    5262
    5363void ?{}(A & this, A other) {
    54   printf("begin copy construct A\n");
     64  this.id = AID++;
     65  printf("begin copy construct A id: %d\n", this.id);
    5566  printf("copy construct this.x\n");
    5667  (this.x){ other.x };
     
    6172
    6273A ?=?(A & this, A other) {
    63   printf("begin ?=? A\n");
     74  printf("begin ?=? A id: %d\n", this.id);
    6475  this.x = other.x;
    6576  this.y = other.y;
     
    7182struct B {
    7283  A a1, a2, a3;
     84  int id;
    7385};
     86int BID = 0;
    7487
    7588void ?{}(B & b) {
    76   printf("begin construct B\n");
     89  b.id = BID++;
     90  printf("begin construct B id: %d\n", b.id);
    7791  printf("assign b.a2\n");
    7892  b.a2 = (A) { 2 };
     
    86100
    87101void ^?{}(B & b) {
    88   printf("begin destruct B\n");
     102  b.id = BID++;
     103  printf("begin destruct B id: %d\n", b.id);
    89104  b.a2 = (A) { 0 };
    90105  ^(b.a1){};
Note: See TracChangeset for help on using the changeset viewer.