Opened 4 years ago

Closed 4 years ago

#190 closed defect (fixed)

Re-throw-resume incorrectly depends on enclosing function return type

Reported by: mlbrooks Owned by:
Priority: minor Component: cfa-cc
Version: 1.0 Keywords:


#ifdef WONT_WORK
  #define RETTYPE void
  #define RETTYPE int

#include <exception.hfa>


RETTYPE foo() {

    try {
        int x = 1 + 1;
    } catchResume ( CPU_Fire * ) {

-DWONT_WORK actual: compiler error at throwResume, from gcc:

error: void value not ignored as it ought to be

-DWONT_WORK expected, no-args actual: compiler success, linker error for no main

When the error happens, running gcc on -CFA output shows the error is coming from the return ((void)0); line of this function nested in foo.

_Bool handle(struct __cfaehm_base_exception_t *__exception_inst){
    __attribute__ ((unused)) _Bool __ret_bool;
        struct CPU_Fire *__anonymous_object2220;
        if ( (__anonymous_object2220=((struct CPU_Fire *)__cfa__virtual_cast(((const struct __cfa__parent_vtable *)(&_X25_CPU_Fire_vtable_instanceS15CPU_Fire_vtable_1)), ((const struct __cfa__parent_vtable **)__exception_inst)))) ) {
            return ((void)0);
            return 1;

    return 0;

Change History (1)

comment:1 Changed 4 years ago by ajbeach

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.