Re: Using Compound Literal + type-punning to initialize static const array

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 24/11/2014 17:53, Mason wrote:

> Consider the following code: [big snip]

(Perhaps my previous message was too verbose.)

Why does gcc reject the following code:

union foob { int val; struct { int X; } bits; };
static const int u = ((union foob) {.bits = { .X=42 }}).val;

$ gcc -std=gnu89 test.c
test.c:2:30: error: initializer element is not constant
  static const int u = ((union foob) {.bits = { .X=42 }}).val;

Is this related to bug 64067?
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64067

Regards.




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux