Opened 10 months ago

Last modified 10 months ago

#300 new defect

sizeof as a param's usage may leave this param unused — at Initial Version

Reported by: mlbrooks Owned by:
Priority: minor Component: cfa-cc
Version: 1.0 Keywords: sizeof unused
Cc:

Description

void fred( const char & p ) {
    printf( "%zu\n", sizeof(p) );
}

forall( T * )
void mary( const T & p ) {
    printf( "%zu\n", sizeof(p) );
}

int main() {
    char x = 'a';
    fred(x);
    mary(x);
    return 0;
}
$cfa -Wall -Wextra -Werror test.cfa

Expected: run, print 1 twice
Actual: compile error: unused parameter (mangled name of) p, twice

Note that in -CFA output, the sizeof(p) expressions are rewritten as

  • sizeof(const char), within fred
  • _sizeof_Y1T, within mary

Change History (0)

Note: See TracTickets for help on using tickets.