llvm/llvm-project

Can not use C99 function names as variable names in C89

Open

#15.522 geöffnet am 4. Feb. 2013

Auf GitHub ansehen
 (11 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)C++ (10.782 Forks)batch import
bugzillacclang:frontendconfirmedgood first issuerejects-valid

Repository-Metriken

Stars
 (26.378 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 1T 2h) (1.000 gemergte PRs in 30 T)

Beschreibung

Bugzilla Link 15150
Version unspecified
OS All
Reporter LLVM Bugzilla Contributor
CC @gribozavr

Extended Description

The following code doesn't compile in clang, but does in gcc:

int logf = 5;
int main() {
        return logf;
}
# gcc test.c -o test -std=c89
# ./test; echo $?
5
# clang test.c -o test -std=c89
test.c:1:5: error: redefinition of 'logf' as different kind of symbol
int logf = 5;
    ^
test.c:1:5: note: previous definition is here
test.c:4:16: warning: incompatible pointer to integer conversion returning 'float (float)' from a function with result type 'int' [-Wint-conversion]
        return logf;
               ^~~~
1 warning and 1 error generated.

Contributor Guide