Bitstructs no longer overloadable with bitops. #2374

This commit is contained in:
Christoffer Lerno
2025-08-06 14:51:32 +02:00
parent aae873c044
commit 1d25197bfd
4 changed files with 40 additions and 10 deletions

View File

@@ -0,0 +1,14 @@
bitstruct Foo : uint
{
bool test : 2;
}
fn bool Foo.test(self, Foo other) @operator(==) => true;
fn Foo Foo.and(self, uint other) @operator(&) => (Foo)(((uint)self) & other); // #error: Bitstructs do not support
fn Foo Foo.or(self, uint other) @operator(|) => (Foo)(((uint)self) | other); // #error: Bitstructs do not support
fn void Foo.and_eq(&self, uint other) @operator(&=) => *self = (Foo)(((uint)*self) & other); // #error: Bitstructs do not support
fn void Foo.or_eq(&self, uint other) @operator(|=) => *self = (Foo)(((uint)*self) | other); // #error: Bitstructs do not support
fn Foo Foo.neg(self) @operator(~) { return {}; } // #error: Bitstructs do not support