Custom Query (145 matches)

Filters
 
Or
 
  
 
Columns

Show under each result:


Results (28 - 30 of 145)

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
Ticket Resolution Summary Owner Reporter
#52 fixed Resolution fails for initialization Rob Schluntz <rschlunt@…> pabuhr
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 Rob Schluntz <rschlunt@…> Thierry Delisle
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 Rob Schluntz <rschlunt@…> Thierry Delisle
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; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
Note: See TracQuery for help on using queries.