[LLVMbugs] [Bug 15151] New: Ambigious error message when a variable is named after a standard function

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Feb 4 02:59:34 PST 2013


http://llvm.org/bugs/show_bug.cgi?id=15151

             Bug #: 15151
           Summary: Ambigious error message when a variable is named after
                    a standard function
           Product: clang
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: ss23 at ss23.geek.nz
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


The following code gives an ambiguous error message in clang, but a sane one in
gcc:

int logf = 5;
int main() {
        return logf;
}

# gcc test.c -o test
test.c:1:5: warning: built-in function 'logf' declared as non-function [enabled
by default]
# clang test.c -o test
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.

Suggest something like gcc instead: "error: redefinition of built-in/standard
function 'logf' as different kind of symbol", and remove "note: previous
definition is here", or alternatively, just change the second line to "note:
previous definition is in standard library" or similar.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list