{"action":"opened","issue":{"url":"https://api.github.com/repos/Unidata/netcdf-cxx4/issues/17","labels_url":"https://api.github.com/repos/Unidata/netcdf-cxx4/issues/17/labels{/name}","comments_url":"https://api.github.com/repos/Unidata/netcdf-cxx4/issues/17/comments","events_url":"https://api.github.com/repos/Unidata/netcdf-cxx4/issues/17/events","html_url":"https://github.com/Unidata/netcdf-cxx4/issues/17","id":67843839,"number":17,"title":"Wrong affectation operator for NcFile","user":{"login":"Luthaf","id":6141587,"avatar_url":"https://avatars.githubusercontent.com/u/6141587?v=3","gravatar_id":"","url":"https://api.github.com/users/Luthaf","html_url":"https://github.com/Luthaf","followers_url":"https://api.github.com/users/Luthaf/followers","following_url":"https://api.github.com/users/Luthaf/following{/other_user}","gists_url":"https://api.github.com/users/Luthaf/gists{/gist_id}","starred_url":"https://api.github.com/users/Luthaf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Luthaf/subscriptions","organizations_url":"https://api.github.com/users/Luthaf/orgs","repos_url":"https://api.github.com/users/Luthaf/repos","events_url":"https://api.github.com/users/Luthaf/events{/privacy}","received_events_url":"https://api.github.com/users/Luthaf/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-04-11T23:15:09Z","updated_at":"2015-04-11T23:15:09Z","closed_at":null,"body":"The following code throw a `NcBadId` exception\r\n\r\n```cpp\r\n#include <string>\r\n#include <netcdf>\r\n\r\nusing namespace std;\r\nusing namespace netCDF;\r\n\r\nclass Wrapper {\r\npublic:\r\n    Wrapper(string name, string mode) {\r\n        if (mode == \"r\")\r\n            file = NcFile(name, NcFile::read);\r\n        else if (mode == \"w\")\r\n            file = NcFile(name, NcFile::write);\r\n    }\r\n    NcFile file;\r\n};\r\n\r\nint main(int argc, char** argv) {\r\n    Wrapper wrap(\"/Volumes/Aldith/Developpeur/Sciences/Chemharp/tests/data/netcdf/water.nc\", \"r\");\r\n    auto attr = wrap.file.getAtt(\"Conventions\");\r\n    return 0;\r\n}\r\n```\r\n\r\nWhile when I use direct initialisation for the `file` member, everything works.\r\n\r\n```cpp\r\nclass Wrapper {\r\npublic:\r\n     Wrapper(string name, string mode) : file(name, NcFile::read) {}\r\n    NcFile file;\r\n};\r\n```\r\n\r\nMaybe the library is using the default generated `operator=(const NcFile&)`, and this one is not correct. My compiler is clang based on LLVM 3.5."}}