catch without block/scope brackets

Jakob a at b.com
Tue Sep 4 06:25:50 PDT 2007


While this works:

	try
		foo();
	catch {
		fwritefln(stderr, "Can't do that");
	}

This doesn't:

	try
		foo();
	catch
		fwritefln(stderr, "Can't do that");

Giving the errors:

found 'fwritefln' when expecting '('
basic type expected, not (

And so on.


IMHO, the compiler should parse the second piece of code in the same manner as the first piece, since there are (as in the first example) no brackets after the catch keyword defining an object to catch. Right?

I'm using GDC 0.24 on Linux, and i don't know if this is also happening in DMD.



More information about the Digitalmars-d mailing list