http://llvm.org/bugs/show_bug.cgi?id=20245
Bug ID: 20245
Summary: nested-extern: clang reports errors in gcc testsuite
testcase
Product: clang
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: normal
Priority: P
Component: C++
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected]
Classification: Unclassified
Created attachment 12755
--> http://llvm.org/bugs/attachment.cgi?id=12755&action=edit
test case file
The following TC present in gcc testsuite
(https://gcc.gnu.org/bugzilla/show_bug.cgi?id=31775) fails in clang where as it
is successful when compiled using g++ :
extern "C" void abort();
extern int *p;
int main()
{
extern int i;
i = 1;
*p = 2;
if (i == 2)
abort ();
return 0;
}
static int i;
int *p = &i;
when compiled using clang the following errors are thrown:
nested-extern-1.C:16:12: error: static declaration of 'i' follows non-static
declaration
static int i;
^
nested-extern-1.C:8:14: note: previous definition is here
extern int i;
^
nested-extern-1.C:17:11: error: use of undeclared identifier 'i'
int *p = &i;
So wanted to know whether this is correct behaviour that clang is giving or do
we need to replicate what gcc is doing?
--
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