From 6cafc931352551340411fab7621e7c8e54d537c6 Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Fri, 12 Nov 2021 08:03:33 +0000 Subject: [PATCH] -Wfree-nonheap-object warning fix using gcc-11 --- Examples/test-suite/typemap_various.i | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Examples/test-suite/typemap_various.i b/Examples/test-suite/typemap_various.i index 3436bac1c..2caff97dc 100644 --- a/Examples/test-suite/typemap_various.i +++ b/Examples/test-suite/typemap_various.i @@ -61,7 +61,11 @@ void CheckRetTypemapUsed() { %inline { class FFoo { public: - char * Bar(bool b) const { return (char *)"x"; } + char * Bar(bool b) const { + char *ret = new char[2]; + strcpy(ret, b ? "1" : "0"); + return ret; + } }; }