You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
More investigation on that. It looks like it is not the operator=(const NcFile&) which one is missing, but the C++11 operator=(NcFile&&), which is generated by the compiler in that case.
The same issue appears with other constructs like :
NcFile file("file.nc", NcFile::read);
// No "Foo" var in file.nc, this should throw. The operator=(NcVar&&) is used
NcVar var = file.getVar("Foo");
if (var.isNull())
cout << "Error !" << endl; // This does NOT happen
var.getAtt("Bar"); // Boom ! NcBadId here
This usage is fine though :
NcFile file("file.nc", NcFile::read);
// No "Foo" var in file.nc, this should throw. The NcVar(NcVar&&) constructor is used
NcVar var(file.getVar("Foo"));
if (var.isNull())
cout << "Error !" << endl; // This DOES happen
Luthaf
changed the title
Wrong affectation operator for NcFile
Errors with rvalue references in C++11 mode
Apr 12, 2015
Ok, I was wrong all long ... I was not using the latest version, and I ran into this bug. I will propose a PR adding open and close methods to get around this bug.
The following code throw a
NcBadId
exception at theauto attr = wrap.file.getAtt("Conventions");
line.While when I use direct initialisation for the
file
member, everything works.Maybe 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.The text was updated successfully, but these errors were encountered: