[clang] [clang] Fixed inconsistent diagnostics when initializing a constexpr variable with a compound literal (PR #232825)
Abdulmalek Almkainzi via cfe-commits
cfe-commits at lists.llvm.org
Mon Oct 19 08:01:12 PDT 2026
aalmkainzi wrote:
currently in main, the second constexpr fails.
```C
const int a = 1;
constexpr int b = (int){a};
int main()
{
constexpr int b = (int){a};
}
```
The difference stems from the special handling of file scope compound literal. their initializers are converted to constexpr
https://github.com/llvm/llvm-project/pull/232825
More information about the cfe-commits
mailing list