[clang] Add Clang attribute to ensure that fields are initialized explicitly (PR #102040)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 22 06:17:37 PST 2024


https://github.com/AaronBallman commented:

There's still a failure being caught by precommit CI that is related:
```
******************** TEST 'Clang :: SemaCXX/uninitialized.cpp' FAILED ********************
Exit Code: 1
Command Output (stderr):
--
RUN: at line 1: /var/lib/buildkite-agent/builds/linux-56-59b8f5d88-mqg5l-1/llvm-project/github-pull-requests/build/bin/clang -cc1 -internal-isystem /var/lib/buildkite-agent/builds/linux-56-59b8f5d88-mqg5l-1/llvm-project/github-pull-requests/build/lib/clang/20/include -nostdsysteminc -fsyntax-only -Wall -Wuninitialized -Wno-unused-value -Wno-unused-lambda-capture -Wno-uninitialized-const-reference -std=c++1z -verify /var/lib/buildkite-agent/builds/linux-56-59b8f5d88-mqg5l-1/llvm-project/github-pull-requests/clang/test/SemaCXX/uninitialized.cpp
+ /var/lib/buildkite-agent/builds/linux-56-59b8f5d88-mqg5l-1/llvm-project/github-pull-requests/build/bin/clang -cc1 -internal-isystem /var/lib/buildkite-agent/builds/linux-56-59b8f5d88-mqg5l-1/llvm-project/github-pull-requests/build/lib/clang/20/include -nostdsysteminc -fsyntax-only -Wall -Wuninitialized -Wno-unused-value -Wno-unused-lambda-capture -Wno-uninitialized-const-reference -std=c++1z -verify /var/lib/buildkite-agent/builds/linux-56-59b8f5d88-mqg5l-1/llvm-project/github-pull-requests/clang/test/SemaCXX/uninitialized.cpp
error: 'expected-warning' diagnostics expected but not seen:
  File /var/lib/buildkite-agent/builds/linux-56-59b8f5d88-mqg5l-1/llvm-project/github-pull-requests/clang/test/SemaCXX/uninitialized.cpp Line 1517 (directive at /var/lib/buildkite-agent/builds/linux-56-59b8f5d88-mqg5l-1/llvm-project/github-pull-requests/clang/test/SemaCXX/uninitialized.cpp:1519): explicit initialization of field 'c1' will not be enforced in C++20 and later because 'C' has a user-declared constructor, making the type no longer an aggregate
1 error generated.
--
********************
```

https://github.com/llvm/llvm-project/pull/102040


More information about the cfe-commits mailing list