Opened 7 years ago

Closed 7 years ago

#52 closed defect (fixed)

Resolution fails for initialization

Reported by: pabuhr Owned by: Rob Schluntz <rschlunt@…>
Priority: minor Component: cfa-cc
Version: 1.0 Keywords:
Cc:

Description (last modified by Rob Schluntz)

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 (2)

comment:1 Changed 7 years ago by Rob Schluntz

Description: modified (diff)

comment:2 Changed 7 years ago by Rob Schluntz <rschlunt@…>

Owner: set to Rob Schluntz <rschlunt@…>
Resolution: fixed
Status: newclosed

In e41306d:

Transfer env from constructor to SingleInit? when simplifying intrinsic copy constructor [fixes #52]

Note: See TracTickets for help on using tickets.