Closed rofl0r closed 11 years ago
here is a testcase that can reproduce the bug
typedef struct str_struct {
char *s;
unsigned long l;
} str;
#define STRLIT(A) &(str) { (A), sizeof((A) - 1) }
enum foo {
FOO = 0,
BAR,
BAZ
};
const str *arr[BAZ] = {
[FOO] = STRLIT("foo"),
[BAR] = STRLIT("bar"),
};
Your testcase is fixed in d7384b0b065dd6195ac6649c4d48a06905bc8fe7. (Also note that your first "working" testcase will fail in practice since compound literal in functions have automatic storage and can get deallocated when the function exits.)
butch.c:512:18: error: Initialisation expression '&(stringptr){ ("#!/bin/sh\n%BUTCH_CONFIG\nexport butch_package_name=%BUTCH_PACKAGE_NAME\nbutch_cache_dir=\"$C\"\nwget -O \"$butch_cache_dir/%BUTCH_TARBALL\" '%BUTCH_MIRROR_URL'\n"), (sizeof("#!/bin/sh\n%BUTCH_CONFIG\nexport butch_package_name=%BUTCH_PACKAGE_NAME\nbutch_cache_dir=\"$C\"\nwget -O \"$butch_cache_dir/%BUTCH_TARBALL\" '%BUTCH_MIRROR_URL'\n") - 1) }' is not constant
[1] https://github.com/rofl0r/butch tarball with embedded dependencies and portable Makefile is available here https://github.com/downloads/rofl0r/butch/butch-0.1.5.tar.bz2 (62KB)
btw, this test program here works