[clang] [analyzer] Do list initialization for CXXNewExpr with initializer list arg (PR #127702)
Michael Flanders via cfe-commits
cfe-commits at lists.llvm.org
Thu Feb 20 07:10:44 PST 2025
================
@@ -0,0 +1,38 @@
+// RUN: %clang_analyze_cc1 -w -verify %s\
+// RUN: -analyzer-checker=core\
+// RUN: -analyzer-checker=debug.ExprInspection -std=c++17
+// RUN: %clang_analyze_cc1 -w -verify %s\
+// RUN: -analyzer-checker=core\
+// RUN: -analyzer-checker=debug.ExprInspection -std=c++11\
+// RUN: -DTEST_INLINABLE_ALLOCATORS
+// RUN: %clang_analyze_cc1 -w -verify %s\
+// RUN: -analyzer-checker=core\
+// RUN: -analyzer-checker=debug.ExprInspection -std=c++17\
+// RUN: -DTEST_INLINABLE_ALLOCATORS
+
+void clang_analyzer_eval(bool);
+
+typedef __typeof(sizeof(int)) size_t;
+
+namespace CustomClassType {
+struct S {
+ int x;
+ static void* operator new(size_t size) {
+ return ::operator new(size);
+ }
+};
+void F() {
+ S *s = new S;
+ clang_analyzer_eval(s->x); // expected-warning{{UNKNOWN}} FIXME: should be an undefined warning
+
+ S *s2 = new S{};
+ clang_analyzer_eval(0 == s2->x); // expected-warning{{TRUE}}
+
+ S *s3 = new S{1};
+ clang_analyzer_eval(1 == s3->x); // expected-warning{{TRUE}}
+}
+
+struct WithPlacementNew {
+};
----------------
Flandini wrote:
Forgot to remove. Removed in fa6c4926fd69be4dab5314aa949edbe91762adef
https://github.com/llvm/llvm-project/pull/127702
More information about the cfe-commits
mailing list