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

    <tr>
        <th>Summary</th>
        <td>
            libclang `clang_getFieldDeclBitWidth` assumes the bit width expression is evaluable 
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

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

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

<pre>
    `clang_getFieldDeclBitWidth` checks if the provided cursor is a bitfield declaration then proceeds to call `FieldDecl::getBitWidthValue` which in turn calls `Expr::EvaluateKnownConstInt` on the bit width expression.

`EvaluateKnownConstInt` requires the expression not be dependent on any template parameters. However, `clang_getFieldDeclBitWidth` doesn't account for this, and libclang does not expose an obvious way to check if an expression's value depends on a template parameter.

https://github.com/rust-lang/rust-bindgen/issues/2239 is related
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyFUktv2zAM_jX2hWigyI4TH3zoK9iw-3YcZIm1tSpSJtHJ-u9HqU27Ad0KGLYM8nvwo8ZgnoaqE9opP32fkPYWnblD7W4sfbOGZi6CnlE_JrAPQDPCMYaTNWhALzGFCDaBgtHSQ4aCYayKimzwudvndo1oElAArZwDZnxVqZprflj3IvdVuQWz5nm2egbLJEv0BZgy8v7XMT6D7k_cqgi_-HD2t8En-uwpI5-FsyM4Z0pAxmBK7GhVibtKXL-8me1fHBF_LpZBhekNDz4QjMhDHtEb9JTFlH8CwsPRMREcefYDEsa0gk_hjCeMlbyFDyM2AZOv5JZAaR0WZn7gaGm2KcOVN-DsWChKazHCvkJCLkIYTzYsCc7qqcSc95XXxaU388yeIA988Z-K-3e8_xXTTHRMOXK552eyNC_jSocD_8Ql0VX2dDmP1psJWWlvU1qQve-lbPp8RSJmDVOboTF906uaLDkcXqf6MCHFjIeXjby32yyCZZ-jQ6iX6Ib_WHfudPlc8Q39gZr-dL3purat50Gud03XNL1er8W6M6bROyl3ohMj6m4jRe3UiC4N1eamktLjGQoFn6vNXW0HKaQUWynWvdiut6t20-u2bXdKmq3Uoq9agQdl3Sr7WIU41XEolsZlSlx0NlF6K3IEdvKIRY751UJziIOeR_WIUdRFeyjefwMy2k8Q">