[clang] e81f9cd - [AST][test] Add regression test forPointerExprEvaluator::VisitCXXNewExpr

Jan Korous via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 9 12:11:27 PDT 2020


Author: Jan Korous
Date: 2020-07-09T12:11:08-07:00
New Revision: e81f9cd2137f258fd1ec6a169db836387bcca84a

URL: https://github.com/llvm/llvm-project/commit/e81f9cd2137f258fd1ec6a169db836387bcca84a
DIFF: https://github.com/llvm/llvm-project/commit/e81f9cd2137f258fd1ec6a169db836387bcca84a.diff

LOG: [AST][test] Add regression test forPointerExprEvaluator::VisitCXXNewExpr

This assert was failing:
assert(CAT && "unexpected type for array initializer");

until this patch landed:
9a7eda1bece887ca9af085d79fe6e4fb8826dcda
PR45350: Handle unsized array CXXConstructExprs in constant evaluation

Added: 
    clang/test/AST/regression-new-expr-crash.cpp

Modified: 
    

Removed: 
    


################################################################################
diff  --git a/clang/test/AST/regression-new-expr-crash.cpp b/clang/test/AST/regression-new-expr-crash.cpp
new file mode 100644
index 000000000000..81dd193b93e8
--- /dev/null
+++ b/clang/test/AST/regression-new-expr-crash.cpp
@@ -0,0 +1,13 @@
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown -fsyntax-only %s
+
+struct Bar {int a;};
+const Bar arr[2] = {{1}};
+
+struct Foo {};
+
+const int b = 2;
+
+void foo(int a) {
+  Foo *foo_array;
+  foo_array = new Foo[arr[0].a];
+}


        


More information about the cfe-commits mailing list