[llvm-bugs] [Bug 24623] New: Error on redefinition of builtin functions.

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Aug 28 18:47:15 PDT 2015


https://llvm.org/bugs/show_bug.cgi?id=24623

            Bug ID: 24623
           Summary: Error on redefinition of builtin functions.
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: chengniansun at gmail.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

I declare a variable with the name "rint", which accidentally is a builtin
function. Then clang rejects the code, although I do not include the header
file <math.h>. 

Even though this behavior was deliberate, the message is still confusing,
"tmp.c:1:5: note: previous definition is here", as the first line is not the
the location of the previous definition. 


$ clang-trunk -O0 -c tmp.c

tmp.c:1:5: error: redefinition of 'rint' as different kind of symbol

int rint; 

    ^

tmp.c:1:5: note: previous definition is here

1 error generated.

$ 

$ gcc-trunk -O0 -c tmp.c

tmp.c:1:5: warning: built-in function ‘rint’ declared as non-function

 int rint; 

     ^

$ 

$ cat tmp.c

int rint; 



$

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150829/91633e4a/attachment-0001.html>


More information about the llvm-bugs mailing list