[LLVMbugs] [Bug 13500] New: Wrong type for variable sized array when size comes from Objective-C method invocation

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Jul 31 23:40:22 PDT 2012


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

             Bug #: 13500
           Summary: Wrong type for variable sized array when size comes
                    from Objective-C method invocation
           Product: clang
           Version: 3.1
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: 691D2C6C-B023-46A5-B1D7-ACCBA4713A87 at uuid-mail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Building the following code using: /usr/bin/clang++ -std=gnu++11 -framework
Foundation test.mm

    #import <Foundation/Foundation.h>

    int main (int argc, char const* argv[])
    {
        NSArray* obj = nil;

        int buf[ [obj count] ];
        int* arr = &buf[0];

        return 0;
    }

Produce this error:

    test.mm:8:17: error: subscripted value is not an array, pointer, or vector
            int* arr = &buf[0];
                        ~~~^~
    1 error generated.

This is using Xcode 4.4 for Mountain Lion:

    Apple clang version 4.0 (tags/Apple/clang-421.0.57) (based on LLVM 3.1svn)
    Target: x86_64-apple-darwin12.0.0
    Thread model: posix

The same code works with clang 3.2 from trunk (r160101).

-- 
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