Opened 7 years ago
Closed 7 years ago
#52 closed defect (fixed)
Resolution fails for initialization
Reported by: | pabuhr | Owned by: | |
---|---|---|---|
Priority: | minor | Component: | cfa-cc |
Version: | 1.0 | Keywords: | |
Cc: |
Description (last modified by )
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
Description: | modified (diff) |
---|
comment:2 Changed 7 years ago by
Owner: | set to Rob Schluntz <rschlunt@…> |
---|---|
Resolution: | → fixed |
Status: | new → closed |
Note: See
TracTickets for help on using
tickets.
In e41306d: