bugGNU Octave - Bugs: bug #55812, Interpreter gives incorrect line...


bug #55812: Interpreter gives incorrect line number for class name / file name mismatch

Submitted by:  Rik <rik5>
Submitted on:  Sat 02 Mar 2019 06:22:12 PM UTC  
Category:  Interpreter Severity:  2 - Minor
Priority:  5 - Normal Item Group:  Inaccurate Result
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  Closed
Release:  dev Operating System:  Any

Add a New Comment(Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


Wed 17 Apr 2019 05:16:23 PM UTC, comment #5:

Beautiful. Very clear now where the error is. Marking as fixed and closing report.

Rik <rik5>
Project Administrator
Wed 17 Apr 2019 04:05:02 PM UTC, comment #4:

I pushed two changes to fix this problem:


John W. Eaton <jwe>
Project Administrator
Mon 25 Mar 2019 09:23:07 PM UTC, comment #3:

This looks harder to fix than I had hoped. Unfortunately, the parser has already advanced to the endclassdef statement when the function in oct-parse.yy that emits the error is invoked.

Rik <rik5>
Project Administrator
Sun 03 Mar 2019 03:22:16 PM UTC, comment #2:

classdef needs to be the first true code in a file, and the keyword can only occur once in the file.

Rik <rik5>
Project Administrator
Sun 03 Mar 2019 08:47:28 AM UTC, comment #1:

With a classdef, is it like a function in that the first line of script code must match the file name? Or is it that the definition must exist somewhere within the file? If the former, then yeah Line #1 makes more sense. If the latter, then maybe Line #[last line] makes more sense--but if that were the case then the error shouldn't be "the class name must match the filename".

Dan Sebald <sebald>
Sat 02 Mar 2019 06:22:12 PM UTC, original submission:

When parsing a classdef file the name of the class must match the name of the file exactly. If it does not, Octave emits an error about the mismatch, but incorrectly points to the line in the file corresponding to "endclassdef" rather than the true source of the error which is the initial "classdef" statement.

I found this accidentally with the following code which I placed in the lowercase filename "mydumbclass.m"

When trying to create an instance of the class I received the following error

It would be better if it cited line 1 and gave this reference

Rik <rik5>
Project Administrator


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by jwe (Posted a comment)
  • -email is unavailable- added by sebald (Posted a comment)
  • -email is unavailable- added by rik5 (Submitted the item)

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.




    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-04-17 rik5 StatusReady For Test => Fixed
        Open/ClosedOpen => Closed
    2019-04-17 jwe StatusConfirmed => Ready For Test

    Back to the top

    Powered by Savane 3.4