Am 23.09.22 um 12:09 schrieb Martin Kaiser:
This function compiles

void dummy123(void)
{
     { enum { BLA = 2 }; };
     { enum { BLA = 2 }; };
}


but this one doesn't:

void dummy123(void)
{
     { enum { BLA = 2 }; };
     volatile int a = 3;
     { enum { BLA = 2 }; };
}

That these two are handled differently looks like a bug to me; I suggest to file a bug report.

BTW: The whole point of this exercise is to use a compile-time assert macro
such as

#define ct_assert(e) { enum { ct_assert_value = 1/(!!(e)) }; }

and allow this to be used before and after variable declarations.

Why not just use static_assert?

Philipp



_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to