We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0a9bc4c commit e14945bCopy full SHA for e14945b
clang/test/Analysis/initializer.cpp
@@ -445,6 +445,25 @@ void nested_aggregates() {
445
}
446
} // namespace newexpr_init_list_initialization
447
448
+namespace initializer_list_arg {
449
+struct S {
450
+ int x;
451
+};
452
+void aggregate_struct() {
453
+ S s;
454
+ ::new (&s) S{1};
455
+ clang_analyzer_eval(1 == s.x); // expected-warning{{TRUE}}
456
+
457
+ S vi;
458
+ ::new (&vi) S{};
459
+ clang_analyzer_eval(0 == vi.x); // expected-warning{{TRUE}}
460
461
+ S di;
462
+ ::new (&di) S;
463
+ int z = di.x + 1; // expected-warning{{The left operand of '+' is a garbage value}}
464
+}
465
+} // namespace initializer_list_arg
466
467
namespace CXX17_transparent_init_list_exprs {
468
class A {};
469
0 commit comments