Bitfileds Error: no identifier for declarator

data pulverizer data.pulverizer at gmail.com
Thu Oct 28 05:20:35 UTC 2021


Hi,

I am trying to compile the following items:


```
import std.bitmanip: bitfields;

enum TYPE_BITS = 5;
enum NAMED_BITS = 16;

struct sxpinfo_struct {
   mixin(bitfields!(
     SEXPTYPE, "type", TYPE_BITS,
     uint, "scalar",   1,
     uint, "obj",      1,
     uint, "alt",      1,
     uint, "gp",      16,
     uint, "mark",     1,
     uint, "debug",    1,
     uint, "trace",    1,
     uint, "spare",    1,
     uint, "gcgen",   1,
     uint, "gccls",   3,
     uint, "named",  NAMED_BITS,
     uint, "extra",  32 - NAMED_BITS));
}
```

But I get the error:

```
Error: no identifier for declarator `uint`
Error: identifier or integer expected inside `debug(...)`, not `)`
Error: found `@` when expecting `)`
Error: no identifier for declarator `safe`
Error: declaration expected, not `return`
Error: no identifier for declarator `void`
Error: identifier or integer expected inside `debug(...)`, not 
`uint`
Error: found `v` when expecting `)`
Error: declaration expected, not `)`
Error: declaration expected, not `assert`
Error: basic type expected, not `cast`
Error: found `cast` when expecting `;`
Error: declaration expected, not `(`
```

All referencing the `bitfields` `mixin`, more specifically the 
last two lines but I think it's actually referencing the expanded 
`mixin` rather than my declaration.

Thanks


More information about the Digitalmars-d-learn mailing list