C++17

ZombineDev via Digitalmars-d digitalmars-d at puremagic.com
Wed Jan 27 12:09:28 PST 2016


On Wednesday, 27 January 2016 at 17:08:09 UTC, Andrei 
Alexandrescu wrote:
> On 01/27/2016 09:51 AM, Shachar Shemesh wrote:
>>
>> import std.stdio;
>>
>> struct RAII {
>>      int num;
>>
>>      ~this() {
>>          writefln("Destructed %s", num);
>>      }
>> }
>>
>> struct Container {
>>      int num;
>>      RAII raii;
>>
>>      this(int num) {
>>          writefln("Constructing %s", num);
>>          this.num = num;
>>          raii = RAII(num);
>>
>>          if( num==0 )
>>              throw new Exception("Ooops");
>>      }
>> }
>>
>> void test(int num) {
>>      try {
>>          auto c = Container(num);
>>          writefln("Point %s", num);
>>      } catch(Exception ex) {
>>          writefln("Caught %s", ex.msg);
>>      }
>> }
>>
>> void main()
>> {
>>      test(1);
>>      test(0);
>> }
>
> Interesting. It may be worked around, but is arguably a mistake 
> in the language definition. Have you submitted an issue for 
> this? -- Andrei

https://github.com/D-Programming-Language/dmd/pull/5151 has been 
on the table since Aug 14, 2015.


More information about the Digitalmars-d mailing list