Custom Query (145 matches)
Results (28 - 30 of 145)
Ticket | Resolution | Summary | Owner | Reporter |
---|---|---|---|---|
#52 | fixed | Resolution fails for initialization | ||
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 } |
|||
#54 | fixed | return not detected | ||
Description |
#struct node { node * next; }; static inline node *& get_next( node & this ) { return node.next; } generates error : test.c:5:1 error: Non-void function returns no values: Return Statement, returning: |
|||
#55 | fixed | intrusive stack crash | ||
Description |
This code crashes the compiler : #define NULL (void*)0 trait is_node(dtype T) { T*& get_next( T& ); }; forall(dtype T | is_node(T)) struct __stack { T * top; }; forall(dtype T | is_node(T)) void ?{}( __stack(T) & this ) { this.top = NULL; } forall(dtype T | is_node(T) | sized(T)) void push( __stack(T) & this, T * val ) { get_next( *val ) = this.top; this.top = val; } forall(dtype T | is_node(T) | sized(T)) T * pop( __stack(T) & this ) { T * top = this.top; if( top ) { this.top = get_next( *top ); get_next( *top ) = NULL; } return top; } struct node; static inline node *& get_next( node & this ); __stack(node) n; struct node { node * next; }; static inline node *& get_next( node & this ) { return this.next; } |
Note: See TracQuery
for help on using queries.