[cfe-dev] Weird clang behaviour wrt identifiers with the same name of builtin functions

Douglas Gregor dgregor at apple.com
Tue Jul 7 10:01:38 PDT 2009


On Jul 7, 2009, at 7:56 AM, Abramo Bagnara wrote:

> This little program fails to compile with clang r74831
>
> $ cat w.c
> void f1() {
>  int index = 1;
> }
>
> static int index;
>
> int f() {
>  return index << 2;
> }
> [snip diagnostics]
> 3 diagnostics generated.
>
> This seems to happen only with builtin function name and only if there
> is a locally scoped variabile with the same name.
>
> It looks very strange to me, I hope someone is able to shed some light
> on this failure.

Clang is being too eager when implicitly building declarations for  
builtins. I've fixed it in r74917. Thanks for the bug report!

	- Doug



More information about the cfe-dev mailing list