================
@@ -14,7 +14,7 @@ struct A { int a; A(int a) : a(a) {} virtual ~A(); };
 // PartialTranslationUnit.
 inline A::~A() { printf("~A(%d)\n", a); }
 
-// Create one instance with new and delete it.
+// Create one instance with new and delete it. We crash here now:
 A *a1 = new A(1);
----------------
weliveindetail wrote:

With `-O2` this test fails unexpectedly now. Minimal repro:
```
clang-repl> struct A { int a; A(int a) : a(a) {} virtual ~A() {} };
clang-repl> A *a1 = new A(1);
clang-repl: llvm/include/llvm/ADT/SmallVector.h:308: const_reference 
llvm::SmallVectorTemplateCommon<llvm::PointerAlignElem>::operator[](size_type) 
const [T = llvm::PointerAlignElem]: Assertion `idx < size()' failed.
```

The following still works and thus I assume it's related to 
https://github.com/llvm/llvm-project/commit/c861d32d7c2791bdc058d9d9fbaecc1c2f07b8c7:
```
clang-repl> struct A { int a; A(int a) : a(a) {} virtual ~A() {} }; A *a1 = new 
A(1);
```

@hahnjo Maybe we now process init code that clashes with your above fix. Do you 
think that's possible? Any idea how to handle it? If possible, I'd like to 
submit the patch as-is with the test `XFAIL`ed for later investigation.

https://github.com/llvm/llvm-project/pull/84758
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to