diff -r c9082b847f79 libinterp/octave-value/ov-classdef.cc --- a/libinterp/octave-value/ov-classdef.cc Sat Feb 04 13:36:48 2017 +0100 +++ b/libinterp/octave-value/ov-classdef.cc Sun Feb 05 22:16:28 2017 +0100 @@ -1817,16 +1817,36 @@ // Look into superclasses Cell super_classes = get ("SuperClasses").cell_value (); + cdef_method meth; + int i1; + int nfnd = 0; for (int i = 0; i < super_classes.numel (); i++) { cdef_class cls = lookup_class (super_classes(i)); - cdef_method meth = cls.find_method (nm); - - if (meth.ok ()) - return meth; + cdef_method meth_candidate = cls.find_method (nm); + + if (meth_candidate.ok ()) + { + nfnd++; + if (nfnd == 1) + { + i1 = i; + meth = meth_candidate; + } + if (nfnd == 2) + { + cdef_class cls_i1 = lookup_class (super_classes(i1)); + error ("method %s: conflicting definitions in classes %s and %s", + meth.get_name ().c_str (), + cls_i1.get_name ().c_str (), + cls.get_name ().c_str ()); + } + } } + if (nfnd == 1) + return meth; } return cdef_method ();