<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW " title="NEW --- - Cannot initialize variable with rvalue of same type?" href="https://urldefense.proofpoint.com/v2/url?u=https-3A__llvm.org_bugs_show-5Fbug.cgi-3Fid-3D24259&d=AwMBaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=pF93YEPyB-J_PERP4DUZOJDzFVX5ZQ57vQk33wu0vio&m=Jp2f9QqE4u4QKdIAjbUv07o3hbSXCcBWUpi4NNo-mAQ&s=CIsfh-IQ77P60GLq-l-_fvlIlmAQ6SLc_mLmVFQCHU0&e=">24259</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Cannot initialize variable with rvalue of same type?
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Frontend
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>paul_robinson@playstation.sony.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>$ 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.
<a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__clang.llvm.org_compatibility.html-23vla&d=AwMBaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=pF93YEPyB-J_PERP4DUZOJDzFVX5ZQ57vQk33wu0vio&m=Jp2f9QqE4u4QKdIAjbUv07o3hbSXCcBWUpi4NNo-mAQ&s=bu5svH1HVguMd4UBo50oFqt2BbOHrB7lBPSv9Lz6x_A&e=">http://clang.llvm.org/compatibility.html#vla</a>

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.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>