Re: [Vala] throw not checking throw type correctly



On Sat, 2008-11-08 at 03:02 -0600, Dwight Schauer wrote:
Alright, I know this is invalid code, but it compiles with warnings, and
seg faults when run. The problem is that the vala compiler did not
identify the invalid code and call it an error.


---< start error.vala >---
using GLib;
int main (string[] args)
{
  try
  {
    stdout.printf("Ok, got here\n");
    throw 1;
    stdout.printf("Ok, but not here\n");
  }
  catch (Error ex)
  {
    stdout.printf("Ex: %s\n",ex.message);
  }
  return 0;
}
---< end error.vala >---

$ valac error.vala 
error.vala:11.5-11.40: warning: unreachable code detected
    stdout.printf("Ok, but not here\n");
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error.c: In function ‘_main’:
error.c:21: warning: assignment makes pointer from integer without a
cast
Compilation succeeded - 1 warning(s)

2008-11-30  Jürg Billeter  <j bitron ch>

        * vala/valathrowstatement.vala:

        Check type of error expression in throw statements

Fixed in r2090.

Jürg




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]