Issue 1048: Mixed [non-]designated initializer behavior

Authors: Aaron Ballman
Date: 2026-04-22
Submitted against: C23
Status: Open

Consider the following code:

#include <stdio.h>

struct {
    char str[16];
} hello = {
    "hello world",
    .str[6] = 'W',
    "ORLD"
};

int main(void) {
    printf("hello.str = \"%s\"\n", hello.str);

    printf("raw bytes: ");
    for (int i = 0; i < 16; i++) {
        printf("%d ", (unsigned char)hello.str[i]);
    }
    printf("\n");

    return 0;
}

What should this program output?

Which, if any, of these behaviors is the expected one? I can see a reading of the standard that allows for any of the first three behaviors depending on how you interpret C23 6.7.11p18-19.


Comment from Issues list maintainer on 2026-11-26:

This issue was discussed at the November 2026 (Búzios) meeting of WG14. It was suggested that this code should be disallowed because of the lack of clear semantics, and Alejandro Colomar took an action item to write a paper proposing a new constraint.