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

            Bug ID: 45157
           Summary: Clang and gcc disagree on whether a `static const
                    struct` is a compile-time constant
           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],
                    [email protected], [email protected]
            Blocks: 4068

```
struct foo {};
struct bar{
    struct foo foo;
};

static const struct foo my_foo = {};
static const struct bar my_bar = {
    .foo = my_foo,
};
```
Clang produces:
```
<source>:8:12: error: initializer element is not a compile-time constant

    .foo = my_foo,

           ^~~~~~
```
GCC has no error.

A recent CI run on the Linux kernel failed for Clang on this patch:
https://cgit.freedesktop.org/~jani/drm/commit/?h=device-info-inheritance-v3&id=329fec687c7310f3a68ae1c6fd3638274484f149


Referenced Bugs:

https://bugs.llvm.org/show_bug.cgi?id=4068
[Bug 4068] [Meta] Compiling the Linux kernel with clang
-- 
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