www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Possible bug - should the following code cause an access violation

reply "Afshin" <davidnia1 gmail.com> writes:
module test;

class Foo {
     public static ulong next = 0;

     public static ulong getNext() {
         return next++;
     }
}

void main() {
     Foo.getNext();
}

/*
The next++ is the culprit.
Using a ++next does not throw an exception.
*/
Dec 29 2013
parent reply =?UTF-8?B?QWxpIMOHZWhyZWxp?= <acehreli yahoo.com> writes:
On 12/29/2013 10:38 PM, Afshin wrote:
 module test;

 class Foo {
      public static ulong next = 0;

      public static ulong getNext() {
          return next++;
      }
 }

 void main() {
      Foo.getNext();
 }

 /*
 The next++ is the culprit.
 Using a ++next does not throw an exception.
 */
Must have already been fixed. No problem on git head. Ali
Dec 30 2013
parent reply "Afshin" <davidnia1 gmail.com> writes:
Thanks Ali.

I uninstalled 2.63.x.
Installed the 2.64.2.

I compiled and ran the test, and surely enough there were no 
problems.

However, when I build using Visual D environment, the problem 
persists.

Microsoft Visual Studio 2010 Ultimate.
Visual D plugin.

Thankfully, there is a simple workaround, but hopefully someone 
can get to the bottom of this issue.
Dec 30 2013
parent =?UTF-8?B?QWxpIMOHZWhyZWxp?= <acehreli yahoo.com> writes:
On 12/30/2013 04:55 PM, Afshin wrote:
 Thanks Ali.

 I uninstalled 2.63.x.
 Installed the 2.64.2.

 I compiled and ran the test, and surely enough there were no problems.

 However, when I build using Visual D environment, the problem persists.

 Microsoft Visual Studio 2010 Ultimate.
 Visual D plugin.

 Thankfully, there is a simple workaround, but hopefully someone can get
 to the bottom of this issue.
Not unless somebody files a bug report. ;) https://d.puremagic.com/issues/ Ali
Dec 30 2013