Opened 6 years ago

Closed 2 years ago

#121 closed defect (fixed)

Comparison failure

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

Description

The following mostly works but fails on the last line for intptr in the conditional expression:

forall( otype T ) T * nullptr( void ) { return (T *)0; }
forall( otype T ) T * intptr( int v = 0 ) { return (T *)v; }

void fred() {
    int * pi;
    pi = nullptr();
    pi = intptr( 0xed234ff5 );
    if ( pi == nullptr() );
    if ( pi == intptr( 0xed234ff5 ) );
}
cfa test1.cfa
CFA Version 1.0.0 (debug)
test1.cfa:47:1 error: Types:
  _57_15_DT -> signed int
Non-types:

unbound type variable: _45_456_T in application Application of
  Variable Expression: intptr: forall
    T: sized object type
    ... with assertions
      ?=?: pointer to function
      ... with parameters
        pointer to instance of type T (not function type)
        instance of type T (not function type)
      ... returning
        _retval__operator_assign: instance of type T (not function type)
        ... with attributes:
          Attribute with name: unused


      ?{}: pointer to function
      ... with parameters
        pointer to instance of type T (not function type)
      ... returning nothing

      ?{}: pointer to function
      ... with parameters
        pointer to instance of type T (not function type)
        instance of type T (not function type)
      ... returning nothing

      ^?{}: pointer to function
      ... with parameters
        pointer to instance of type T (not function type)
      ... returning nothing


    function
  ... with parameters
    v: signed int with initializer (maybe constructed)
      Simple Initializer: Generated Cast of:
        constant expression (0 0: zero_t)
      ... to:
        signed int

  ... returning
    _retval_intptr: pointer to instance of type T (not function type)
    ... with attributes:
      Attribute with name: unused


... to arguments
  Generated Cast of:
    constant expression (0xed234ff5 3978514421: unsigned int)
  ... to:
    signed int
  with inferred parameters 0:
    ?=?: function
    ... with parameters
      intrinsic pointer to signed int
      intrinsic signed int
    ... returning
      _retval__operator_assign: signed int
      ... with attributes:
        Attribute with name: unused


    ?{}: function
    ... with parameters
      intrinsic pointer to signed int
    ... returning nothing

    ?{}: function
    ... with parameters
      intrinsic pointer to signed int
      intrinsic signed int
    ... returning nothing

    ^?{}: function
    ... with parameters
      intrinsic pointer to signed int
    ... returning nothing

Change History (1)

comment:1 Changed 2 years ago by Thierry Delisle

Resolution: fixed
Status: newclosed

This code now compiles.

Note: See TracTickets for help on using tickets.