summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
Diffstat (limited to 'source')
-rw-r--r--source/core/slang-string.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/source/core/slang-string.h b/source/core/slang-string.h
index 028eec3e4..ecdba46be 100644
--- a/source/core/slang-string.h
+++ b/source/core/slang-string.h
@@ -315,6 +315,15 @@ namespace Slang
return cloneWithCapacity(newCapacity);
}
+
+ /// Overload delete to silence ASAN new-delete-type-mismatch errors.
+ /// These occur because the allocation size of StringRepresentation
+ /// does not match deallocation size (due variable sized string payload).
+ void operator delete(void* p)
+ {
+ StringRepresentation* str = (StringRepresentation*) p;
+ ::operator delete(str);
+ }
};
class String;