www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Weird error after moving code from Linux to Windows

reply "Hamburger-san" <gddgf sdfgsd.com> writes:
I was expecting something to break, but I thought it'd be more 
along the lines of file paths...

For whatever reason, my compiler really doesn't like it when I 
try to access my Array!SomeStruct opIndex function. It gives me 
the following Error

Error: inout method 
std.container.array.Array!(SomeStruct).Array.opIndex is not 
callable using a mutable object

struct SomeStruct {
     AppState!U state;
     int id;
}
Array!(SomeStruct) states_; //can allocate to this fine
Array!(AppState!U) stack_;

void somefunction(){
     stack_.reserve(4);
     stack_ = make!(Array!(AppState!U));
     stack_.insertBack( (states_[0].state) ); //errors
}
void someotherfunction(){
     ...
     auto state = states_[aa]; //also errors
     ...
}

It compiles fine on my Linux machine and I can't figure out what 
I'm doing wrong here...
Jul 31 2015
parent reply Steven Schveighoffer <schveiguy yahoo.com> writes:
On 7/31/15 11:34 AM, Hamburger-san wrote:
 I was expecting something to break, but I thought it'd be more along the
 lines of file paths...

 For whatever reason, my compiler really doesn't like it when I try to
 access my Array!SomeStruct opIndex function. It gives me the following
 Error

 Error: inout method std.container.array.Array!(SomeStruct).Array.opIndex
 is not callable using a mutable object

 struct SomeStruct {
      AppState!U state;
      int id;
 }
 Array!(SomeStruct) states_; //can allocate to this fine
 Array!(AppState!U) stack_;

 void somefunction(){
      stack_.reserve(4);
      stack_ = make!(Array!(AppState!U));
      stack_.insertBack( (states_[0].state) ); //errors
 }
 void someotherfunction(){
      ...
      auto state = states_[aa]; //also errors
      ...
 }

 It compiles fine on my Linux machine and I can't figure out what I'm
 doing wrong here...
Same version of compiler? Same compiler? -Steve
Jul 31 2015
parent "Hamburger-san" <doodad ffsds.com> writes:
On Friday, 31 July 2015 at 15:59:02 UTC, Steven Schveighoffer 
wrote:
 Same version of compiler? Same compiler?

 -Steve
 Same version of compiler? Same compiler?

 -Steve
(just checking now on my linux) Yeah, same compiler: DMD2 They're both up to date and version: 2.067.1 Both machines are x64.
Jul 31 2015