[LLVMbugs] [Bug 20245] New: nested-extern: clang reports errors in gcc testsuite testcase

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Jul 8 05:58:12 PDT 2014


            Bug ID: 20245
           Summary: nested-extern: clang reports errors in gcc testsuite
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: mayur.p at samsung.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    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
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20140708/15400b83/attachment.html>

More information about the llvm-bugs mailing list