I am currently refactoring some old code to meet C++14 standards of correctness and something weird is happening.
This error is so far unique and does not appear in the rest of the code. I've obfuscated the actual types because they aren't important.
Prior to the refactor, the following code worked just fine:
namespace N {
class A {
public:
A(B* blah) : _blah(blah); //class A owns the instance of class B.
~A() { delete m_blah; m_blah = nullptr; }
//...Lots more code.
private:
B* m_blah;
};
}
I changed any necessary ownership-based pointers to their respective smart pointers:
#include <memory>
namespace N {
class A {
public:
A(std::unique_ptr<B> blah);
~A() { /* DO NOTHING */ }
private:
std::unique_ptr<B> m_blah;
};
}
This no longer works. Intellisense reports an error:
"Error: namespace "N::std" has no member unique_ptr"
in the constructor declaration. (But NOT the declaration of m_blah
)
....What? Why is the standard library namespace being pulled into N?!
Versioning Info:
I booted up VS this morning and the problem disappeared on its own.
In an attempt to make sure I can isolate any future problems and since the code base is massive I went back to square one to see if I could prevent the error:
So far, so good.