<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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 - constexpr can't handle vector types"
   href="https://bugs.llvm.org/show_bug.cgi?id=42461">42461</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>constexpr can't handle vector types
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>Windows NT
          </td>
        </tr>

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

        <tr>
          <th>Severity</th>
          <td>enhancement
          </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>llvm-dev@redking.me.uk
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
          </td>
        </tr>

        <tr>
          <th>Blocks</th>
          <td>31446
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Godbolt: <a href="https://godbolt.org/z/l-RaB7">https://godbolt.org/z/l-RaB7</a>

We are unable to use __vector_size or ext_vector_type defined types in
constexpr functions.


typedef int __v4si __attribute__((__vector_size__(16)));

constexpr int sum_i32(__v4si x) {
  return x[0] + x[1] + x[2] + x[3];
}

constexpr __v4si add_i32(__v4si x, __v4si y) {
  return x + y;
}

clang -g0 -O3 

<source>:3:18: error: constexpr function never produces a constant expression
[-Winvalid-constexpr]

constexpr __v4si add_i32(__v4si x, __v4si y) {
                 ^

<source>:4:12: note: subexpression not valid in a constant expression
  return x + y;

           ^

<source>:7:15: error: constexpr function never produces a constant expression
[-Winvalid-constexpr]

constexpr int sum_i32(__v4si x) {

              ^

<source>:8:10: note: subexpression not valid in a constant expression
  return x[0] + x[1] + x[2] + x[3];</pre>
        </div>
      </p>

        <div id="referenced">
          <hr style="border: 1px dashed #969696">
          <b>Referenced Bugs:</b>
          <ul>
              <li>
                [<a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [feature-request] make vector intrinsics constexpr"
   href="https://bugs.llvm.org/show_bug.cgi?id=31446">Bug 31446</a>] [feature-request] make vector intrinsics constexpr
              </li>
          </ul>
        </div>
        <br>

      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>