[cfe-dev] Weird clang behaviour wrt identifiers with the same name of builtin functions
Abramo Bagnara
abramobagnara at tin.it
Tue Jul 7 07:56:39 PDT 2009
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;
}
$ ~/llvm/Debug/bin/clang-cc z.c
z.c:51:12: error: redefinition of 'index' as different kind of symbol
static int index;
^
z.c:48:7: note: previous definition is here
int index = 1;
^
z.c:54:16: error: invalid operands to binary expression ('char *(char
const *,
int)' and 'int')
return index << 2;
~~~~~ ^ ~
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.
More information about the cfe-dev
mailing list