changeset 33588:97b44c6e3e35 stable

inputParser.m: Allow default classdef objects which overload "struct" (bug #65667). inputParser.m: Call "builtin ('struct', ...)" rather than bare struct() to avoid calling potentially overloaded 'struct' method.
author Rik <rik@octave.org>
date Thu, 16 May 2024 08:30:23 -0700
parents 3216c01fd6a7
children f07a7fe7bd51 ca958ca8c921
files scripts/miscellaneous/inputParser.m
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/miscellaneous/inputParser.m	Tue May 14 22:03:47 2024 +0200
+++ b/scripts/miscellaneous/inputParser.m	Thu May 16 08:30:23 2024 -0700
@@ -364,9 +364,10 @@
 
       if (iscell (def))
         ## Accept cell default values (bug #64305).
-        this.Parameter(end+1) = struct ("name", name, "def", {def}, "val", val);
+        ## Use builtin() to avoid struct overload in classdef (bug #65667)
+        this.Parameter(end+1) = builtin ("struct", "name", name, "def", {def}, "val", val);
       else
-        this.Parameter(end+1) = struct ("name", name, "def", def, "val", val);
+        this.Parameter(end+1) = builtin ("struct", "name", name, "def", def, "val", val);
       endif
 
     endfunction