Opened 8 years ago

Last modified 8 years ago

#52 closed defect

Resolution fails for initialization — at Initial Version

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

Description

void ?{}( int & c, zero_t ) { c = 0; }

trait sumable( otype T ) {

void ?{}( T &, zero_t ); constructor from 0 literal
T ?+?( T, T );
assortment of additions
T ?+=?( T &, T );
T ++?( T & );
T ?++( T & );

}; sumable
forall( otype T | sumable( T ) )
use trait
T sum( unsigned int size, T * a ) {

T total = 0; instantiate T from 0 by calling its constructor
for ( size_t i = 0; i < size; i += 1 )

total += a[i]; select appropriate +

return total;

}
forall( otype Impl | sumable( Impl ) )
struct Foo {

Impl * x, * y;

};
int foo() {

int sa[ 5 ];
int i /* = sum( 5, sa ) */; DOES NOT RESOLVE
i = sum( 5, sa );
RESOLVES
Foo(int) foo;
int j /* = sum( 5, foo.x ) */; DOES NOT RESOLVE
j = sum( 5, foo.x );
RESOLVES

}

Change History (0)

Note: See TracTickets for help on using tickets.