[clang] [clang][bytecode] Check if block is initialized before invoking destructor (PR #174082)

Timm Baeder via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 1 23:43:44 PST 2026


================
@@ -0,0 +1,21 @@
+// RUN: %clang_cc1 -std=c++20 -fsyntax-only -fexperimental-new-constant-interpreter -verify %s
+// expected-no-diagnostics
+
+// Test for issue #173950: Assertion `IsInitialized' failed when evaluating
+// typeid on a reference to a dynamically allocated object.
+
+namespace std {
+class type_info {};
+}
+
+namespace GH173950 {
+struct A {
+  virtual void f();
+};
+
+static A &a = *new A;
+extern A &a;
+
+// This used to crash with: Assertion `IsInitialized' failed in invokeDtor()
+const std::type_info &a_ti = typeid(a);
----------------
tbaederr wrote:

I'd rather add this to `typeid.cpp` if possible.

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


More information about the cfe-commits mailing list