[PATCH] D155270: [clang][Interp] Basic support for bit fields

Shafik Yaghmour via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 17 15:33:35 PDT 2023


shafik added inline comments.


================
Comment at: clang/test/AST/Interp/bitfields.cpp:36
+  // TODO: +=, -=, etc. operators.
+}
----------------
This is an interesting test case:

```
struct A {int c:3;};

constexpr int f() {
  A a1{3};
  return a1.c++;
}

void g() {
    constexpr int x = f();
}
```

We are overflowing the bit-field value but it is implementation defined what the value is 😱 CC @aaron.ballman 

Might be worth checking the result of conditional operator and comma etc are bit-fields when they are supposed to be and therefore sizeof fails for those cases. 


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D155270/new/

https://reviews.llvm.org/D155270



More information about the cfe-commits mailing list