www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 4270] New: Missing line number in 'can only catch class objects' error message

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4270

           Summary: Missing line number in 'can only catch class objects'
                    error message
           Product: D
           Version: 2.041
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Keywords: diagnostic, patch
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: clugdbug yahoo.com.au


--- Comment #0 from Don <clugdbug yahoo.com.au> 2010-06-04 12:51:32 PDT ---
void bug4270()
{
  try{} catch(int banana) {}
}
--
Error: can only catch class objects, not 'int'
--

PATCH:
statement.c 4197
void Catch::semantic(Scope *sc)

    type = type->semantic(loc, sc);
    if (!type->toBasetype()->isClassHandle())
-        error("can only catch class objects, not '%s'", type->toChars());
+        error(loc, "can only catch class objects, not '%s'", type->toChars());

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 04 2010
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4270



--- Comment #1 from Don <clugdbug yahoo.com.au> 2010-06-04 13:15:49 PDT ---
Bug 3712 is a combination of this bug, with a D1-only error.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 04 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4270


bearophile_hugs eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bearophile_hugs eml.cc


--- Comment #2 from bearophile_hugs eml.cc 2010-06-04 13:20:59 PDT ---
An idea: comment out the error() that doesn't accept a line number, then fix
all calling points that use it.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 04 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4270



--- Comment #3 from Don <clugdbug yahoo.com.au> 2010-06-04 17:36:00 PDT ---
(In reply to comment #2)
 An idea: comment out the error() that doesn't accept a line number, then fix
 all calling points that use it.
That's exactly how I found this one! There are four uses of the wrong function. It's discussed in dmd-internals. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 04 2010
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4270


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla digitalmars.com
         Resolution|                            |FIXED


--- Comment #4 from Walter Bright <bugzilla digitalmars.com> 2010-06-09
19:09:30 PDT ---
http://www.dsource.org/projects/dmd/changeset/532

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 09 2010