Thread overview
Bitfileds Error: no identifier for declarator
Oct 28, 2021
data pulverizer
Oct 28, 2021
data pulverizer
Oct 28, 2021
Imperatorn
Oct 28, 2021
Imperatorn
Oct 28, 2021
data pulverizer
Oct 28, 2021
Stanislav Blinov
October 28, 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

October 28, 2021

On Thursday, 28 October 2021 at 05:20:35 UTC, data pulverizer wrote:

>

Hi,

I am trying to compile the following items ...

Sorry forgot to prepend:

enum SEXPTYPE
{
  NILSXP = 0,
  SYMSXP = 1,
  LISTSXP = 2,
  CLOSXP = 3,
  ENVSXP = 4,
  PROMSXP = 5,
  LANGSXP = 6,
  SPECIALSXP = 7,
  BUILTINSXP = 8,
  CHARSXP = 9,
  LGLSXP = 10,
  INTSXP = 13,
  REALSXP = 14,
  CPLXSXP = 15,
  STRSXP = 16,
  DOTSXP = 17,
  ANYSXP = 18,
  VECSXP = 19,
  EXPRSXP = 20,
  BCODESXP = 21,
  EXTPTRSXP = 22,
  WEAKREFSXP = 23,
  RAWSXP = 24,
  S4SXP = 25,
  NEWSXP = 30,
  FREESXP = 31,
  FUNSXP = 99
}

In case someone is trying to replicate the error.

October 28, 2021

On Thursday, 28 October 2021 at 05:20:35 UTC, data pulverizer wrote:

>

Hi,

I am trying to compile the following items:

[...]

Try renaming debug to something else

October 28, 2021

On Thursday, 28 October 2021 at 05:20:35 UTC, data pulverizer wrote:

>

I am trying to compile the following items:

struct sxpinfo_struct {
mixin(bitfields!(
// ...
uint, "debug", 1,
// ...
}


But I get the error...

debug is a language keyword, try a different one, like "debug_".

That error message though, much wow.

October 28, 2021

On Thursday, 28 October 2021 at 05:51:27 UTC, Imperatorn wrote:

>

On Thursday, 28 October 2021 at 05:20:35 UTC, data pulverizer wrote:

>

Hi,

I am trying to compile the following items:

[...]

Try renaming debug to something else

uint, "debugflag", 1,

October 28, 2021

On Thursday, 28 October 2021 at 05:51:27 UTC, Imperatorn wrote:

>

Try renaming debug to something else

Many thanks guys. I should have spotted that one!