Opened 17 months ago

#168 new defect

Plan-9 inheritance is not considered for satisfying a trait's assertion

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

Description

This code should be valid:

struct club {
    int membercount;
};

struct finalclub {
    inline club;
    float endowment;
};

void showmembers( club & c ) {
}

forall( dtype T | { void showmembers( T & ); } )
void show_fancy_members(T & x) {
    showmembers(x);
}

int main() {
    finalclub phoenix;
    showmembers( phoenix );

    #ifdef THE_ERROR
    show_fancy_members( phoenix );
    #endif
}

But cfa-cc gives the error:

No alternatives with satisfiable assertions for Applying untyped:
  Name: show_fancy_members
...to:
  Name: phoenix
      Unsatisfiable alternative:
        ...
        Environment:( _111_0_T ) -> instance of struct finalclub with body 1

      Could not satisfy assertion:
showmembers: pointer to function
        ... with parameters
          reference to instance of type _111_0_T (not function type)
        ... returning nothing

The error is saying it needs, but cannot find, a function matching

    void showmembers( [type of phoenix] & );

while the previous line has the successful call

    showmembers( phoenix );

Change History (0)

Note: See TracTickets for help on using tickets.