<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/128109>128109</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [HLSL][Sema] Misleading error message with `packoffset` on a struct or array
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            HLSL
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          hekota
      </td>
    </tr>
</table>

<pre>
    It seems that DXC only allows `packsoffset` annotations on a struct or array to be aligned to the buffer row (`packoffset(c#)` or `packoffset(c#.x)`).
Placing the struct on the `.y`, `.z`. or `.w` element results in an `error: register or offset bind not valid`.

Clang reports `error: packoffset cannot cross register boundary` which is confusing because the struct or array theoretically fits the buffer row (16 bytes).

```
struct S {
  float a;
};

cbuffer CB0 {
  S s : packoffset(c0.y);
  float f[2] : packoffset(c2.y);
}
```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJxsk92OozoMx58m3FiDQvgqF1zQVtU50hzpSL3Z2xAMZCdNqjhMt_v0qzDM16pSBIli_-y_Y0siPVnElpV7Vh4TuYTZ-XbGFxdk0rvh3v4bgBAvBGGWAY4_DuCsuYM0xt0IWMWvUr2QG0fCwCoO0loXZNDOEjgLEij4RQVwHqT38g7BQY8gTQw8xFOYEfplHNGDdzdgYrdRN6jYKSZyJpqIdx4e3aa_3u6ZaFLGu_-NVNpOK_o9vl1PrOLpfTU8rPvf8bNR01uMgAYvaAN4pMUEAm1B2niN3jvP8g48TpoC-uj2lgX02g5gXYBXafQQWYx3jHcHI-0EHq_OB_oG-ZQAaq0ZKO-IPuG9W-wgfUwWbrNWM2gC5ey4UJTWo5IL4TeJHyWe0XkMWklj7jDqQA-KnFXQ3wPSVrK4Kr4t3m3IM7B6z3gHMBonA0iWxyOrj9uGd2rDHvb8w_gMBN9FxneKlRfNm-M7cGTlXrDy-MBcfDGPAb8kmAxtPjR5IxNss7rgGS-aapfMbc1FM2ZNVeUoyyoTtSrzplJ8J4t8bAqe6FZwUXIhMi5EI3ZpPZZVnu2KuilkXamMFRwvUpvUmNdL6vyUaKIF20zsMt4kRvZoaJ0XIf55Pj8zEdNPfBvtn_plIlZwoynQJyHoYNYZWx3KIyv3Z7zIKPs_TQblEF90bQ24IJGcEG46zH-1emz_BxOVLN60cwhXYnnHxImJ06TDvPSpchcmTjGN7fd09e4nqsDEaVVFTJw2Ya-t-BMAAP__wQpEzg">