Initialise _v to 0 in typecheck case
This avoids using _v uninitialised if there's an empty typecheck
typemap, such as the dummy one we have for std::initializer_list.
Fixes GCC warning on cpp11_initializer_list testcase when compiled
with -O2.
diff --git a/CHANGES.current b/CHANGES.current
index f0b7a0f..aa33c09 100644
--- a/CHANGES.current
+++ b/CHANGES.current
@@ -7,6 +7,11 @@
Version 4.1.0 (in progress)
===========================
+2021-04-19: olly
+ Fix use of uninitialised variable in the generated code for an
+ empty typecheck typemap, such as the dummy one we include for
+ std::initializer_list.
+
2021-04-12: olly
#1777 [Python] Specifying -py3 now generates a check for Python
version >= 3.0.
diff --git a/Source/Modules/overload.cxx b/Source/Modules/overload.cxx
index 5d27810..512c5da 100644
--- a/Source/Modules/overload.cxx
+++ b/Source/Modules/overload.cxx
@@ -809,7 +809,7 @@
}
if (num_arguments) {
- Printf(f, "int _v;\n");
+ Printf(f, "int _v = 0;\n");
}
int num_braces = 0;