[LLVMbugs] [Bug 11654] New: Refusal to compile (*array)[][] assignments

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Dec 26 19:02:15 PST 2011


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

             Bug #: 11654
           Summary: Refusal to compile (*array)[][] assignments
           Product: clang
           Version: 2.9
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: radford at blackbean.org
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


int main(int c, char **v)
{
    const bool p = 0;
    bool q = 0;
    int a=0, (*b)[q | p ? 2 : 1]
      = (int (* )[q | p ? 2 : 1])&a;
    return (*b)[0];
}

This will not compile with g++ from llvm-gcc-4.2-2.9-x86_64-apple-darwin10
unless I s/bool/int/g, s/const//g or s/^bool/const bool/g.  Only s/^bool/const
bool/g compiles with clang++ from clang+llvm-3.0-x86_64-apple-darwin11.

The former's error message is following.  Note the identical types.

  error: cannot convert ‘int (*)[(((long unsigned int)(q ? 1 : 0)) + 1u)]’ to
‘int (*)[(((long unsigned int)(q ? 1 : 0)) + 1u)]’ in initialization

The later's is the following.  Note again the identical types.

  error: cannot initialize a variable of type 'int (*)[q | p ? 2 : 1]' with an
rvalue of type 'int (*)[q | p ? 2 : 1]'

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