Delegated Construction Question: Compiler Error C2039: '{ctor}' is not a member of Logging::LogManager
I am using Microsoft's C++ November 2012 CTP Compiler, not the default one in Visual Studio 2012, so I have access to new C++ features, (variadic templates, etc).
I am trying to get delegated construction to work using namespaces and header files... I am not certain if this falls under the base constructor inheritance features yet to be implemented in Visual Studio 2012; so, it may be the case that I shouldn't expect this to work:
How do you do this in C++ 11?
// LogManager.h extract
namespace Logging {
class LogManager
{
private:
static std::wstring defaultFileName;
explicit LogManager(std::wstring logFileName);
explicit LogManager();
~LogManager(void);
}
// LogManager.cpp extract
/********************************************************************
*****/
Logging::LogManager::LogManager(std::wstring fileName)
{}
/********************************************************************
*****/
Logging::LogManager::LogManager()
: LogManager(defaultFileName) // Yields C2664
// : Logging::LogManager::LogManager(defaultFileName) // Yields C2039
// : Logging::LogManager(defaultFileName) // Yields C2614
{}
error C2039: '{ctor}' : is not a member of 'Logging::LogManager'
error C2614: 'Logging::LogManager' : illegal member initialization: 'LogManager' is not a base or member
error C2664: 'Logging::LogManager::LogManager(const Logging::LogManager &)' : cannot convert parameter 2 from 'std::wstring' to 'const Logging::LogManager &'
Answer:: Cannot use explicit keyword in header file per known bug already known to Microsoft.
Only the first signature will work of the Constructor will work with this .. workaround.