﻿id	summary	reporter	owner	description	type	status	priority	component	version	resolution	keywords	cc
258	Unclear intended type for char literal	mlbrooks		"Bug or feature?  Here is a case of C disagreeing with CFA.  Are we okay with it?  If so, we need to fix CFA's behaviour to be self-consistent.  If not, we need to reconcile this point of C compatibility with our rules for overload selection.

C's preferred type for 'x' is int.  Today's CFA mostly prefers type char.

This disagreement is a point of backward incompatibility.  Yet, CFA's overloading provides precedent for ""CFA is right.""

The incompatibility:
{{{
#include <stdio.h>

int main( int argc, char ** argv ) {
    printf(""sizeof('x') is %ld\n"", sizeof('x'));

    typeof('x') var = 'x';
    printf(""sizeof(var) is %ld\n"", sizeof(var));

    printf(""sizeof(typeof('x')) is %ld\n"", sizeof(typeof('x')));
}
}}}
CFA, actual:
{{{
sizeof('x') is 4
sizeof(var) is 1
sizeof(typeof('x')) is 1
}}}
GCC, actual:
{{{
sizeof('x') is 4
sizeof(var) is 4
sizeof(typeof('x')) is 4
}}}
Proposed self-consistent, for CFA:
{{{
sizeof('x') is 1
sizeof(var) is 1
sizeof(typeof('x')) is 1
}}}


Precedent for, ""'x' should be a char."" (Code is CFA only)
{{{
void f( int ) {
    printf(""int overload called\n"");
}

void f( char ) {
    printf(""char overload called\n"");
}

int main( int argc, char ** argv ) {
    typeof('q') var;
    printf(""%ld\n"", sizeof(var));
    f( 'q' );
    f( var );
}
}}}
CFA, actual and expected:
{{{
1
char overload called
char overload called
}}}
"	defect	new	minor	cfa-cc	1.0			
