[LLVMbugs] [Bug 7147] New: Error new'ing with typedef of array type

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sun May 16 08:45:34 PDT 2010


           Summary: Error new'ing with typedef of array type
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: dgregor at apple.com
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com
            Blocks: 6023

In the following test, from Boost.Python, we appear to be new'ing the wrong

cove:test dgregor$ cat t.cpp 
struct foo { foo() {} ~foo() {} };

int main()
    typedef int a[2];
    foo* f1 = new foo;
    foo* f2 = new foo[2];
    typedef foo x[2];
    typedef foo y[2][2];
    x* f3 = new y;
    return 0;
cove:test dgregor$ clang++ t.cpp 
t.cpp:10:8: error: cannot initialize a variable of type 'x *' (aka 'foo
      with an rvalue of type 'y *' (aka 'foo (*)[2][2]')
    x* f3 = new y;
1 error generated.
cove:test dgregor$ g++ t.cpp
cove:test dgregor$ eccp t.cpp

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