{"action":"created","issue":{"url":"https://api.github.com/repos/HaxeFoundation/haxe/issues/4187","labels_url":"https://api.github.com/repos/HaxeFoundation/haxe/issues/4187/labels{/name}","comments_url":"https://api.github.com/repos/HaxeFoundation/haxe/issues/4187/comments","events_url":"https://api.github.com/repos/HaxeFoundation/haxe/issues/4187/events","html_url":"https://github.com/HaxeFoundation/haxe/issues/4187","id":72076738,"number":4187,"title":"[cpp] Unable to modify Array<T> from inlined method","user":{"login":"MSGhero","id":5033927,"avatar_url":"https://avatars.githubusercontent.com/u/5033927?v=3","gravatar_id":"","url":"https://api.github.com/users/MSGhero","html_url":"https://github.com/MSGhero","followers_url":"https://api.github.com/users/MSGhero/followers","following_url":"https://api.github.com/users/MSGhero/following{/other_user}","gists_url":"https://api.github.com/users/MSGhero/gists{/gist_id}","starred_url":"https://api.github.com/users/MSGhero/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MSGhero/subscriptions","organizations_url":"https://api.github.com/users/MSGhero/orgs","repos_url":"https://api.github.com/users/MSGhero/repos","events_url":"https://api.github.com/users/MSGhero/events{/privacy}","received_events_url":"https://api.github.com/users/MSGhero/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/HaxeFoundation/haxe/labels/regression","name":"regression","color":"e11d21"}],"state":"open","locked":false,"assignee":{"login":"hughsando","id":1665494,"avatar_url":"https://avatars.githubusercontent.com/u/1665494?v=3","gravatar_id":"","url":"https://api.github.com/users/hughsando","html_url":"https://github.com/hughsando","followers_url":"https://api.github.com/users/hughsando/followers","following_url":"https://api.github.com/users/hughsando/following{/other_user}","gists_url":"https://api.github.com/users/hughsando/gists{/gist_id}","starred_url":"https://api.github.com/users/hughsando/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hughsando/subscriptions","organizations_url":"https://api.github.com/users/hughsando/orgs","repos_url":"https://api.github.com/users/hughsando/repos","events_url":"https://api.github.com/users/hughsando/events{/privacy}","received_events_url":"https://api.github.com/users/hughsando/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/HaxeFoundation/haxe/milestones/1","html_url":"https://github.com/HaxeFoundation/haxe/milestones/3.2","labels_url":"https://api.github.com/repos/HaxeFoundation/haxe/milestones/1/labels","id":343008,"number":1,"title":"3.2","description":"","creator":{"login":"issuesbot","id":4543331,"avatar_url":"https://avatars.githubusercontent.com/u/4543331?v=3","gravatar_id":"","url":"https://api.github.com/users/issuesbot","html_url":"https://github.com/issuesbot","followers_url":"https://api.github.com/users/issuesbot/followers","following_url":"https://api.github.com/users/issuesbot/following{/other_user}","gists_url":"https://api.github.com/users/issuesbot/gists{/gist_id}","starred_url":"https://api.github.com/users/issuesbot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/issuesbot/subscriptions","organizations_url":"https://api.github.com/users/issuesbot/orgs","repos_url":"https://api.github.com/users/issuesbot/repos","events_url":"https://api.github.com/users/issuesbot/events{/privacy}","received_events_url":"https://api.github.com/users/issuesbot/received_events","type":"User","site_admin":false},"open_issues":10,"closed_issues":569,"state":"open","created_at":"2013-05-28T03:42:24Z","updated_at":"2015-05-01T23:35:24Z","due_on":"2015-03-21T23:00:00Z","closed_at":null},"comments":16,"created_at":"2015-04-30T06:29:58Z","updated_at":"2015-05-09T13:18:47Z","closed_at":null,"body":"In the setup below, using an inlined method to add to an `Array<T>` doesn't do anything unless `<T>` is not an Int/Bool/Float/String (the ones I've tried). It works fine when the generic is removed and the array is given any type or when the `push` method is not inlined. It also works fine if I manually index into the array or if I manually reset the array.\r\n```haxe\r\nclass Test {\r\n    \r\n    public static function main() {\r\n\r\n        var s0 = new Stack<Int>();\r\n        s0.push(0);\r\n        s0.push(1);\r\n        Lib.trace(s0.arr); // expected: [0,1], actual: []\r\n        // manual indexing\r\n\t    s0.arr[0] = 7;\r\n        s0.push(8);\r\n        Lib.trace(s.arr); // expected: [7,1,8], actual: [7]\r\n        \r\n        // same results for String, Bool, and Float\r\n        \r\n        var s1 = new Stack<String>();\r\n        // manually reset array\r\n        s1.arr = []; // or s1.clear()\r\n        s1.push(\"0\");\r\n        s1.push(\"1\");\r\n        Lib.trace(s1.arr); // expected: [\"0\",\"1\"], actual: [\"0\",\"1\"]\r\n\t    s1.arr[0] = \"7\";\r\n        s1.push(\"8\");\r\n        Lib.trace(s1.arr); // expected: [\"7\",\"1\",\"8\"], actual: [\"7\",\"1\",\"8\"]\r\n\r\n        var s2 = new Stack<Dynamic>();\r\n        // works as expected\r\n        s2.push({});\r\n        s2.push({});\r\n        Lib.trace(s2.arr); // expected: [{},{}], actual: [{},{}]\r\n        s2.arr[0] = {};\r\n        Lib.trace(s2.arr); // expected: [{},{}], actual: [{},{}]\r\n    }\r\n}\r\n\r\nclass Stack<T> {\r\n    \r\n    public var arr:Array<T>;\r\n    public var len(default, null):Int;\r\n    \r\n    public function new() {\r\n        clear();\r\n    }\r\n    \r\n    public inline function clear():Void {\r\n        // I've tried this inlined and not, doesn't change things\r\n        arr = [];\r\n        len = 0;\r\n    }\r\n    \r\n    public inline function push(t:T):Void{\r\n        // inlining this causes issue\r\n        arr[len++] = t;\r\n    }\r\n}\r\n```\r\nI'm testing this with openfl->windows. Works as expected on flash.\r\n\r\nLatest master version of all libs, haxe 3.2.0-rc2."},"comment":{"url":"https://api.github.com/repos/HaxeFoundation/haxe/issues/comments/100483930","html_url":"https://github.com/HaxeFoundation/haxe/issues/4187#issuecomment-100483930","issue_url":"https://api.github.com/repos/HaxeFoundation/haxe/issues/4187","id":100483930,"user":{"login":"hughsando","id":1665494,"avatar_url":"https://avatars.githubusercontent.com/u/1665494?v=3","gravatar_id":"","url":"https://api.github.com/users/hughsando","html_url":"https://github.com/hughsando","followers_url":"https://api.github.com/users/hughsando/followers","following_url":"https://api.github.com/users/hughsando/following{/other_user}","gists_url":"https://api.github.com/users/hughsando/gists{/gist_id}","starred_url":"https://api.github.com/users/hughsando/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hughsando/subscriptions","organizations_url":"https://api.github.com/users/hughsando/orgs","repos_url":"https://api.github.com/users/hughsando/repos","events_url":"https://api.github.com/users/hughsando/events{/privacy}","received_events_url":"https://api.github.com/users/hughsando/received_events","type":"User","site_admin":false},"created_at":"2015-05-09T13:18:47Z","updated_at":"2015-05-09T13:18:47Z","body":"(There was not point checking for KTypeParameter, since I think it has been replaced already)"}}