https://bugs.llvm.org/show_bug.cgi?id=42604

            Bug ID: 42604
           Summary: -Wuninitialized for struct assignment from GNU C
                    statement expression
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected], [email protected],
                    [email protected], [email protected],
                    [email protected], [email protected]

Consider the following example:

void init(int*);

void foo(void) {
    int i = ({
        init(&i);
        i;
    });
}

struct widget {
    int x, y;
};
void init2(struct widget*);

void bar(void) {
    struct widget my_widget = ({
        init2(&my_widget);
        my_widget;
    });
}

warning: variable 'my_widget' is uninitialized when used within its own
initialization [-Wuninitialized]

It seems like it's ok to do so for non-aggregate types, but aggregates issue
the warning.  I think it should not be a warning here?

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to