http://llvm.org/bugs/show_bug.cgi?id=16883
Bug ID: 16883
Summary: if declaration and definition of a function differ in
scope, emit a warning
Product: clang
Version: 3.3
Hardware: All
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: -New Bugs
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected]
Classification: Unclassified
Hi,
i just stumbled upon a piece of code like this:
static int foo(void);
int foo(void)
{
volatile int a = 3;
return a;
}
According to http://std.dkuug.dk/JTC1/SC22/open/n2620/n2620.txt --> 6.1.2.2 #7
the behavior in this situation is undefined.
If, within a translation unit, the same identifier
appears with both internal and external linkage, the
behavior is undefined.
Steps to Reproduce:
the code above goes into foo.c
$ clang -Weverything -c foo.c
Actual Results:
clang does not emit a warning when compiling with -Weverything.
scan-build does not warn either, with all checkers enabled.
Expected Results:
clang should emit a warning when compiling such code.
--
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