March 17, 2002 function-level try blocks unsupported | ||||
---|---|---|---|---|
| ||||
DMC doesn't seem to support function-level try blocks, as ISO-C++ says (try to compile code below). I tried with BCC 5.5.1 (which makes a big fuss with its "full" <g> ANSI compliance), and it's not supported, either. It works fine with GCC 2.95.2 or later... For the curious: BCC says "Test::Test() declared outside its class". Oh well... :) Laurentiu //------------------------------------------------- class Thrower { public: Thrower() throw(int); }; Thrower::Thrower() throw(int) { throw 1; } class Test { public: Test() throw (int); private: Thrower t; }; Test::Test() throw(int) try :t() { } catch(int x) { throw x+1; } |
March 17, 2002 Re: function-level try blocks unsupported | ||||
---|---|---|---|---|
| ||||
Posted in reply to Laurentiu Pancescu | I've never encountered that before! Thanks for reporting it. "Laurentiu Pancescu" <user@domain.invalid> wrote in message news:a72bjl$1dd$1@digitaldaemon.com... > DMC doesn't seem to support function-level try blocks, as ISO-C++ says (try > to compile code below). I tried with BCC 5.5.1 (which makes a big fuss with > its "full" <g> ANSI compliance), and it's not supported, either. It works fine with GCC 2.95.2 or later... > > For the curious: BCC says "Test::Test() declared outside its class". Oh > well... :) > > Laurentiu > > //------------------------------------------------- > class Thrower > { > public: > Thrower() throw(int); > }; > > Thrower::Thrower() throw(int) { throw 1; } > > class Test > { > public: > Test() throw (int); > private: > Thrower t; > }; > > Test::Test() throw(int) > try > :t() > { > > } > catch(int x) > { > throw x+1; > } > > > > |
Copyright © 1999-2021 by the D Language Foundation