source: tests/nowarn/printf-sizeof.cfa@ 4be0117

Last change on this file since 4be0117 was d3d54b3, checked in by Michael Brooks <mlbrooks@…>, 8 months ago

Eliminate warnings due to sizeof returning type inconsistent with %zu. Fix #269.

Test

nowarn/printf-sizeof

: Activate direct test of the bug.

Tests

alloc-ERROR
extension
array-collections/dimexpr-match-c-ERRS

: Accommodate incidental changes in error-message text or generated code.

  • Property mode set to 100644
File size: 473 bytes
Line 
1// From fixed Trac #269
2
3forall( T )
4void fred( T x ) {
5 printf( "%zu\n", sizeof(T) );
6 printf( "%zu\n", sizeof(x) );
7 (void) x; // FIX ME: work around Trac #300
8}
9
10#include <array.hfa>
11forall( [N] )
12void mary( array(char, N) & ) {
13 printf( "%zu\n", N );
14 for ( i; N ) {
15 if (i > 0) printf(" ");
16 printf( "%zu", i);
17 }
18 printf("\n");
19}
20
21int main() {
22 char c = 'x';
23 fred(c);
24
25 array( char, 10 ) a;
26 mary(a);
27
28 return 0;
29}
Note: See TracBrowser for help on using the repository browser.