Custom Query (147 matches)
Results (22 - 24 of 147)
Ticket |
---|
#52 |
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 } |
#53 |
Description |
Tuple costs are not computed correctly. For example: [long, long] f() { return [0, -1]; } The difference between the two alternatives being that 1 is converted to signed int or to signed long, and both expressions are given the same cost. test.c:34:1 error: Cannot choose between 2 alternatives for expression Applying untyped: Name: ?{} ...to: Cast of: Variable Expression: _retval_f: tuple of types signed long int signed long int ... to: reference to tuple of types signed long int signed long int Untyped Tuple: constant expression (0 0: zero_t) Applying untyped: Name: -? ...to: constant expression (1 1: one_t) Alternatives are: Cost ( 0, 0, 0, 0 ): Tuple Assignment Expression, with stmt expr: Statement Expression: CompoundStmt Declaration of __multassign_L6: reference to lvalue signed long int with initializer (not constructed) Simple Initializer: Cast of: Tuple Index Expression, with tuple: Variable Expression: _retval_f: tuple of types signed long int signed long int with index: 0 ... to: reference to lvalue signed long int Declaration of __multassign_L7: reference to lvalue signed long int with initializer (not constructed) Simple Initializer: Cast of: Tuple Index Expression, with tuple: Variable Expression: _retval_f: tuple of types signed long int signed long int with index: 1 ... to: reference to lvalue signed long int Declaration of __multassign_R6: zero_t with initializer (maybe constructed) Constructor initializer: ... initially constructed with Implicit Ctor Dtor Statement ... with Ctor/Dtor: Expression Statement: Application of Variable Expression: ?{}: function ... with parameters intrinsic reference to zero_t intrinsic zero_t ... returning nothing ... to arguments Cast of: Variable Expression: __multassign_R6: zero_t ... to: reference to zero_t constant expression (0 0: zero_t) Declaration of __multassign_R7: signed int with initializer (maybe constructed) Constructor initializer: ... initially constructed with Implicit Ctor Dtor Statement ... with Ctor/Dtor: Expression Statement: Application of Variable Expression: ?{}: function ... with parameters intrinsic reference to signed int intrinsic signed int ... returning nothing ... to arguments Cast of: Variable Expression: __multassign_R7: signed int ... to: reference to signed int Application of Variable Expression: -?: function ... with parameters intrinsic signed int ... returning _retval__operator_unaryminus: signed int ... with attributes: Attribute with name: unused ... to arguments Cast of: constant expression (1 1: one_t) ... to: signed int Expression Statement: Tuple: Application of Variable Expression: ?{}: function ... with parameters intrinsic reference to signed long int intrinsic signed long int ... returning nothing ... to arguments Variable Expression: __multassign_L6: reference to lvalue signed long int Cast of: Variable Expression: __multassign_R6: zero_t ... to: signed long int Application of Variable Expression: ?{}: function ... with parameters intrinsic reference to signed long int intrinsic signed long int ... returning nothing ... to arguments Variable Expression: __multassign_L7: reference to lvalue signed long int Cast of: Variable Expression: __multassign_R7: signed int ... to: signed long int (types: void ) Environment: Cost ( 0, 0, 0, 0 ): Tuple Assignment Expression, with stmt expr: Statement Expression: CompoundStmt Declaration of __multassign_L4: reference to lvalue signed long int with initializer (not constructed) Simple Initializer: Cast of: Tuple Index Expression, with tuple: Variable Expression: _retval_f: tuple of types signed long int signed long int with index: 0 ... to: reference to lvalue signed long int Declaration of __multassign_L5: reference to lvalue signed long int with initializer (not constructed) Simple Initializer: Cast of: Tuple Index Expression, with tuple: Variable Expression: _retval_f: tuple of types signed long int signed long int with index: 1 ... to: reference to lvalue signed long int Declaration of __multassign_R4: zero_t with initializer (maybe constructed) Constructor initializer: ... initially constructed with Implicit Ctor Dtor Statement ... with Ctor/Dtor: Expression Statement: Application of Variable Expression: ?{}: function ... with parameters intrinsic reference to zero_t intrinsic zero_t ... returning nothing ... to arguments Cast of: Variable Expression: __multassign_R4: zero_t ... to: reference to zero_t constant expression (0 0: zero_t) Declaration of __multassign_R5: signed long int with initializer (maybe constructed) Constructor initializer: ... initially constructed with Implicit Ctor Dtor Statement ... with Ctor/Dtor: Expression Statement: Application of Variable Expression: ?{}: function ... with parameters intrinsic reference to signed long int intrinsic signed long int ... returning nothing ... to arguments Cast of: Variable Expression: __multassign_R5: signed long int ... to: reference to signed long int Application of Variable Expression: -?: function ... with parameters intrinsic signed long int ... returning _retval__operator_unaryminus: signed long int ... with attributes: Attribute with name: unused ... to arguments Cast of: constant expression (1 1: one_t) ... to: signed long int Expression Statement: Tuple: Application of Variable Expression: ?{}: function ... with parameters intrinsic reference to signed long int intrinsic signed long int ... returning nothing ... to arguments Variable Expression: __multassign_L4: reference to lvalue signed long int Cast of: Variable Expression: __multassign_R4: zero_t ... to: signed long int Application of Variable Expression: ?{}: function ... with parameters intrinsic reference to signed long int intrinsic signed long int ... returning nothing ... to arguments Variable Expression: __multassign_L5: reference to lvalue signed long int Variable Expression: __multassign_R5: signed long int (types: void ) Environment: |
#58 |
Description |
This code crashes the compiler because of "typet_t" instead of "type_t" forall(dtype T | sized(T)) struct wrapper{ T * ptr; int size; }; typedef long long int type_t; struct outer { wrapper(typet_t) w; }; |
Note: See TracQuery
for help on using queries.