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



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




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



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





 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



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