[llvm-bugs] [Bug 37828] New: clang++ fails to allocate a "float (*)[height]" to "float (*)[height]" object

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Jun 17 20:24:46 PDT 2018


https://bugs.llvm.org/show_bug.cgi?id=37828

            Bug ID: 37828
           Summary: clang++ fails to allocate a "float (*)[height]" to
                    "float (*)[height]" object
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: CS15BTECH11029 at iith.ac.in
                CC: llvm-bugs at lists.llvm.org

Clang++ (version 7.0.0 (trunk 334413)) fails to compile the following code


#include <stdlib.h>
void allocateArray(int height) {
        float (* Ix)[height];
        Ix = (float(*) [height]) malloc(sizeof(float)* (height));
}

Error:
clangBugCheck.cpp:4:7: error: assigning to 'float (*)[height]' from
incompatible type 'float (*)[height]'
 Ix = (float(*) [height]) malloc(sizeof(float)* (height));
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.


Command used to compile code: clang++ filename.cpp -c


GCC and ICC are able to compile the code.

-- 
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/20180618/35d9ddbc/attachment.html>


More information about the llvm-bugs mailing list