[cfe-dev] __func__ should be of type char[], not char*

Eli Friedman eli.friedman at gmail.com
Wed Jan 9 20:03:31 PST 2008


See http://llvm.org/bugs/show_bug.cgi?id=1903.  Basic test:

int abcdefghi12(void) {
  static const char* s = __func__;
  const char (*ss)[12] = &__func__;
  return sizeof(__func__);
}

should not give any errors or warnings, and should return 12.

The change in Sema/SemaExpr.cpp is changing the type of __func__ appropriately.

The changes in AST/Expr.cpp makes __func__ be recognized as an lvalue
with static storage duration.

The change in CodeGen/CGExpr.cpp keeps codegen working in the presence
of the new type for __func__.

-Eli
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: fixpredef.txt
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20080109/83d6d7d0/attachment.txt>


More information about the cfe-dev mailing list