{"action":"closed","issue":{"url":"https://api.github.com/repos/Microsoft/vscode-cpptools/issues/1956","repository_url":"https://api.github.com/repos/Microsoft/vscode-cpptools","labels_url":"https://api.github.com/repos/Microsoft/vscode-cpptools/issues/1956/labels{/name}","comments_url":"https://api.github.com/repos/Microsoft/vscode-cpptools/issues/1956/comments","events_url":"https://api.github.com/repos/Microsoft/vscode-cpptools/issues/1956/events","html_url":"https://github.com/Microsoft/vscode-cpptools/issues/1956","id":321244384,"number":1956,"title":"I think it's a bug in this case","user":{"login":"DFVSQY","id":8075421,"avatar_url":"https://avatars3.githubusercontent.com/u/8075421?v=4","gravatar_id":"","url":"https://api.github.com/users/DFVSQY","html_url":"https://github.com/DFVSQY","followers_url":"https://api.github.com/users/DFVSQY/followers","following_url":"https://api.github.com/users/DFVSQY/following{/other_user}","gists_url":"https://api.github.com/users/DFVSQY/gists{/gist_id}","starred_url":"https://api.github.com/users/DFVSQY/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DFVSQY/subscriptions","organizations_url":"https://api.github.com/users/DFVSQY/orgs","repos_url":"https://api.github.com/users/DFVSQY/repos","events_url":"https://api.github.com/users/DFVSQY/events{/privacy}","received_events_url":"https://api.github.com/users/DFVSQY/received_events","type":"User","site_admin":false},"labels":[{"id":413933237,"url":"https://api.github.com/repos/Microsoft/vscode-cpptools/labels/external","name":"external","color":"0052cc","default":false},{"id":348032333,"url":"https://api.github.com/repos/Microsoft/vscode-cpptools/labels/question","name":"question","color":"cc317c","default":true},{"id":799914024,"url":"https://api.github.com/repos/Microsoft/vscode-cpptools/labels/world%20ready","name":"world ready","color":"5319e7","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":7,"created_at":"2018-05-08T15:50:58Z","updated_at":"2018-05-22T19:33:35Z","closed_at":"2018-05-22T19:33:35Z","author_association":"NONE","body":"<!--\r\n  If this is a performance issue report, please use the VS Code Issue reporter via command palette (f1 -> Help: Report Issue).\r\n  Set the field 'This is a' to be 'Performance Issue', the field 'File on' to be 'An Extension', and set 'Extension' to be 'C/C++'.\r\n  You may toggle off the data you wish to not send, but with more information we can help. \r\n  Fill out the title and steps to reproduce with as much info as you can.\r\n  Clicking on 'Preview on GitHub' will open up a webpage for you to submit your issue.\r\n\r\n  If this is a bug report, please give us as much information as possible so we can reproduce your issue.\r\n  Examples of information that can help us find and fix bugs:\r\n    * Operating System and version\r\n    * VS Code version and if you are using the Insiders build\r\n    * C/C++ extension version\r\n    * Other extensions you installed and if the issue persists after disabling them\r\n    * step-by-step instructions to reproduce the issue\r\n    * A small code sample, zipped up project, or open source repo we can use to verify the bug\r\n    * Relevant settings from your settings.json, c_cpp_properties.json, and/or launch.json files\r\n    * Any log messages present in the Output window (use \"C_Cpp.loggingLevel\": \"Information\" in settings.json)\r\n    * Debugger logs (use \"logging\": { \"engineLogging\": true } in your launch.json)\r\n\r\n  Please also take a look at our documentation, as we may already have answers for your questions:\r\n    * https://github.com/Microsoft/vscode-cpptools/tree/master/Documentation\r\n\r\n  Thank you!\r\n-->\r\nClone [my demo project](https://github.com/DFVSQY/VscodeMsvcDemo) on window10 computer that has installed visual studio 2017, then copy below text to **main.cpp** file:\r\n~~~C++\r\n#include <iostream>\r\nusing namespace std;\r\n\r\nclass Useless {\r\n   private:\r\n    int n;\r\n    char *pc;\r\n    static int ct;\r\n    void ShowObject() const;\r\n\r\n   public:\r\n    Useless();\r\n    explicit Useless(int k);\r\n    Useless(int k, char ch);\r\n    Useless(const Useless &f);\r\n    Useless(Useless &&f);\r\n    ~Useless();\r\n    Useless operator+(const Useless &f) const;\r\n    void ShowData() const;\r\n};\r\n\r\nint Useless::ct = 0;\r\n\r\nUseless::Useless() {\r\n    ++ct;\r\n    n = 0;\r\n    pc = nullptr;\r\n    cout << \"default constructor called, number of objects:\" << ct << endl;\r\n    ShowObject();\r\n}\r\n\r\nUseless::Useless(int k) : n(k) {\r\n    ++ct;\r\n    pc = new char[n];\r\n    cout << \"int constructor callled, number of objects:\" << ct << endl;\r\n    ShowObject();\r\n}\r\n\r\nUseless::Useless(int k, char ch) : n(k) {\r\n    ++ct;\r\n    pc = new char[n];\r\n    for (int i = 0; i < n; i++) pc[i] = ch;\r\n    cout << \"int, char constructor called, number of objects:\" << ct << endl;\r\n    ShowObject();\r\n}\r\n\r\nUseless::Useless(const Useless &f) : n(f.n) {\r\n    ++ct;\r\n    pc = new char[n];\r\n    for (int i = 0; i < n; i++) pc[i] = f.pc[i];\r\n    cout << \"copy const called, number of objects:\" << ct << endl;\r\n    ShowObject();\r\n}\r\n\r\nUseless::Useless(Useless &&f) : n(f.n) {\r\n    ++ct;\r\n    cout << \"move constructor callled, number of objects:\" << ct << endl;\r\n    pc = f.pc;\r\n    f.pc = nullptr;\r\n    f.n = 0;\r\n    ShowObject();\r\n}\r\n\r\nUseless::~Useless() {\r\n    cout << \"destructor called, objects left:\" << --ct << endl;\r\n    cout << \"deleted object\\n\";\r\n    ShowObject();\r\n    delete[] pc;\r\n}\r\n\r\nUseless Useless::operator+(const Useless &f) const {\r\n    cout << \"Entering operator+()\\n\";\r\n    Useless temp = Useless(n + f.n);\r\n    for (int i = 0; i < n; i++) {\r\n        temp.pc[i] = pc[i];\r\n    }\r\n    for (int i = n; i < temp.n; i++) {\r\n        temp.pc[i] = f.pc[i - n];\r\n    }\r\n    cout << \"temp object:\\n\";\r\n    cout << \"Leaving operator+()\\n\";\r\n    return temp;\r\n}\r\n\r\nvoid Useless::ShowObject() const {\r\n    cout << \"number of elements:\" << n << \" Data Address:\" << (void *)pc\r\n         << endl;\r\n}\r\n\r\nvoid Useless::ShowData() const {\r\n    if (n == 0)\r\n        cout << \"(object empty)\";\r\n    else\r\n        for (int i = 0; i < n; i++) cout << pc[i];\r\n    cout << endl;\r\n}\r\n\r\nint main() {\r\n    cout << \"---------one------------'\\n\";\r\n    Useless one(10, 'x');\r\n    cout << \"---------two------------'\\n\";\r\n    Useless two = one;\r\n    cout << \"--------three-----------'\\n\";\r\n    Useless three(20, 'o');\r\n    cout << \"---------four-----------'\\n\";\r\n    Useless four(one + three);\r\n\r\n    cout << endl;\r\n\r\n    cout << \"object one: \";\r\n    one.ShowData();\r\n    cout << \"object two: \";\r\n    two.ShowData();\r\n    cout << \"object three: \";\r\n    three.ShowData();\r\n    cout << \"object four: \";\r\n    four.ShowData();\r\n\r\n    cout << endl;\r\n\r\n    return 0;\r\n}\r\n~~~\r\nThen follow these steps:\r\n1.  **Run Build Task** to compile this demo to produce main.exe.\r\n2.  **Run Test Task** to run the main.exe, however the output is not complete and random, e.g:\r\n![image](https://user-images.githubusercontent.com/8075421/39767593-b69ef63a-5319-11e8-8bbf-ed56e808670f.png)\r\nNote: run the main.exe on powershell is ok:\r\n![image](https://user-images.githubusercontent.com/8075421/39767838-4105759c-531a-11e8-9457-10e9a7419e42.png)\r\n"}}
{"actor":{"display_login":"pieandcakes"}}