[cfe-dev] Fix the AST type of strings to be char[]

Eli Friedman eli.friedman at gmail.com
Sat Jan 19 04:49:45 PST 2008


Fix attached.  Mostly straightforward, although the
GenerateConstantExpr bit is a little messy.  I think the fact that few
changes are required shows that the AST representation and sema are
quite flexible.

I ran this against the testsuite; it introduces some spurious failues
due to error messages changing slightly, and causes a couple of real
failures due to the broken struct initializer sema (types in struct
initializers don't get fixed up at the moment, so initializing a char*
member with a string breaks).  To work around that, we can temporarily
change the tests to work using an explicit char* cast, which will
force the introduction of the necessary implicit cast.

This change doesn't have many visible effects; here's a couple of testcases:

void b() {
int aa[sizeof "SizeNineteenString" == 19 ? 1 : -1];
char (*asdf)[19] = &"SizeNineteenString";
}

-Eli
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: stringtypefix.1.txt
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20080119/8ac42934/attachment.txt>


More information about the cfe-dev mailing list