[LLVMbugs] [Bug 12661] New: clang fails to detect invalid application of "sizeof" to an incomplete type when there is a complete type in different scope

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Apr 25 15:56:04 PDT 2012


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

             Bug #: 12661
           Summary: clang fails to detect invalid application of "sizeof"
                    to an incomplete type when there is a complete type in
                    different scope
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Frontend
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: weimingz at codeaurora.org
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Created attachment 8452
  --> http://llvm.org/bugs/attachment.cgi?id=8452
test case

Clang accepts the following erroneous code:

void bar(int);
int foo()
{
  extern int arr[];
  { extern int arr[10]; }
  bar(sizeof(arr)); /* should raise error here */
  return 0;
}

GCC will report the error:
size_of_incomp.c: In function 'foo':
size_of_incomp.c:6: error: invalid application of 'sizeof' to incomplete type
'int[]'

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list