https://llvm.org/bugs/show_bug.cgi?id=24259
Bug ID: 24259 Summary: Cannot initialize variable with rvalue of same type? Product: clang Version: trunk Hardware: PC OS: Linux Status: NEW Severity: normal Priority: P Component: Frontend Assignee: unassignedclangb...@nondot.org Reporter: paul_robin...@playstation.sony.com CC: llvmbugs@cs.uiuc.edu Classification: Unclassified $ cat t.cpp void foo() { int s = 4; int b[1][s]; int (*p)[s] = b + 1; } $ clang -x c -c t.cpp $ clang -x c++ -c t.cpp t.cpp:4:9: error: cannot initialize a variable of type 'int (*)[s]' with an rvalue of type 'int (*)[s]' int (*p)[s] = b + 1; ^ ~~~~~ 1 error generated. VLAs are not part of C++ but Clang claims to support them if everything is nicely POD-like. http://clang.llvm.org/compatibility.html#vla If I take out the "+ 1" C mode is still fine but C++ mode gets: t.cpp:4:9: error: cannot initialize a variable of type 'int (*)[s]' with an lvalue of type 'int [1][s]' int (*p)[s] = b; ^ ~ 1 error generated. -- You are receiving this mail because: You are on the CC list for the bug.
_______________________________________________ LLVMbugs mailing list LLVMbugs@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs