Changes between Version 1 and Version 2 of Ticket #203


Ignore:
Timestamp:
Jul 27, 2020, 11:30:10 AM (4 years ago)
Author:
ajbeach
Comment:

Some of the error cases may have actually been bad code. I removed them and renamed the ticket to hopefully describe the remaining cases better. I also included some more examples of code that do work because I dug up a few cases (copy constructor) that does work. Also I dug up a few more cases that are errors but are almost certainly other errors, maybe this ticket should be split up.

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #203

    • Property Summary changed from Polymorphic Structure and Polymorphic Structure Errors to Polymorphic Structure Initalization Errors
  • Ticket #203 – Description

    v1 v2  
    8888
    8989#elif SHOW_ERROR == 7
    90 void local(void) {
    91     wrap_e(int) error_obj;
    92     // No alternatives:
    93     error_obj = (empty(int)){};
    94 }
     90// Initalizer too deep:
     91wrap_e(bool) error_obj = { {} };
    9592
    9693#elif SHOW_ERROR == 8
    97 void local(void) {
    98     wrap_c(int) error_obj;
    99     // No alternatives:
    100     error_obj = (counter(int)){ 5 };
    101 }
     94// Initalizer too deep:
     95wrap_c(bool) error_obj = { { 0 } };
     96
     97#elif SHOW_ERROR == 9
     98// Assertion failure:
     99wrap_e(bool) error_obj @= { {} };
    102100
    103101#endif
     
    120118    wrap_o(int) wrap_obj = { 13 };
    121119    wrap_o(char) wrap_obj @= { 'c' };
     120
     121    {
     122        wrap_e(bool) alpha;
     123        wrap_e(bool) beta;
     124        beta = alpha;
     125        // alpha.field = beta.field; (See #166.)
     126        wrap_e(bool) delta = { beta };
     127    }
     128    {
     129        wrap_c(bool) alpha;
     130        wrap_c(bool) beta;
     131        beta = alpha;
     132        // alpha.field = beta.field; (See #166.)
     133        wrap_c(bool) delta = { beta };
     134    }
     135
    122136    return 0;
    123137}