Issue 61398
Summary Anonymous union cannot be declared as constexpr
Labels new issue
Assignees
Reporter Fedr
    The following code
```
constexpr static union {
    int i = 1;
} u; //ok everywhere

constexpr static union {
    int k = 1;
}; //error in Clang
```
is fully accepted in GCC, and the first part `u.i` is accepted in Clang. But for the second part the error is shown:
```
union cannot be marked constexpr
```
Online demo: https://gcc.godbolt.org/z/Wd4WWq5Pn

It is either wrong compiler rejection (if GCC is right) or the error message is inexact, considering that the first `constexpr union` is accepted.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to