Opened 7 years ago

Last modified 4 years ago

#8 closed defect

No reasonable alternative — at Version 3

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

Description (last modified by Thierry Delisle)

forall( otype T | { void ?{}( T &, zero_t ); T ?+?( T, T ); } )
  T sum( int n, T a[] ) {
    T total = 0;		// instantiate T, select 0
    for ( int i = 0; i < n; i += 1 )
	total = total + a[i];	// select +
    return total;
}

int mmain() {
    int a[3];
    int i;
    i = sum( 3, a );
}

cfa test10.c
CFA Version 1.0.0 (debug)
test10.c:12 error: No reasonable alternatives for expression Applying untyped:

Name: sum

...to:

constant expression (3: signed int)
Name: a

Change History (3)

comment:1 Changed 7 years ago by Rob Schluntz

Description: modified (diff)

comment:2 Changed 7 years ago by Rob Schluntz

This appears to be related to #3 and #4, as adding these fixes it:

  void ?{}( int *, zero_t );  // need zero_t to int constructor
  void ?{}( int * );          // previous constructor hides default

comment:3 Changed 6 years ago by Thierry Delisle

Description: modified (diff)

Updated code.

Note: See TracTickets for help on using tickets.