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

[email protected] changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |[email protected]
         Resolution|---                         |WORKSFORME

--- Comment #4 from [email protected] ---
gcc 4.2.1 doesn't complain when specifying C99 as the standard (-std=c99). In
C89 (-std=c89) it (correctly) complains about "redeclaration of ā€˜i’ with no
linkage", because in C89 the definitions in the first clause of a for statement
are in the surrounding scope instead of the loop body's scope.

clang also complains when using C89:

% ~/LLVM/build/Release+Asserts/bin/clang -std=c89 clang.c
clang.c:5:14: error: redefinition of 'i'
    for (int i = 0; i < 100; ++i) { }
             ^
clang.c:3:9: note: previous definition is here
    int i;
        ^
1 error generated.


I guess gcc and clang use different C standards as default, which is why you
got the differing results.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to