mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Bitstructs no longer overloadable with bitops. #2374
This commit is contained in:
14
test/test_suite/bitstruct/bitstruct_forbidden_overload.c3
Normal file
14
test/test_suite/bitstruct/bitstruct_forbidden_overload.c3
Normal 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
|
||||
Reference in New Issue
Block a user