我試圖在Visual Studio 2012使用委託構造函數更新3,但我得到一個錯誤:委派構造函數
$> cl.exe /EHsc /W4 /MTd .\bla.cpp
Microsoft (R) C/C++ Optimizing Compiler Version 17.00.60610.1 for x86
Copyright (C) Microsoft Corporation. All rights reserved.
bla.cpp
.\bla.cpp(6) : error C2614: 'Bla' : illegal member initialization: 'Bla' is not
a base or member
示例源文件:
#include <iostream>
class Bla {
public:
Bla() : Bla(10) { std::cout << "bla()" << std::endl; }
Bla(int _n) { std::cout << "bla(int): " << _n << std::endl; }
};
int main()
{
Bla b0;
Bla b1(10);
}
似乎具有worked before並在this video(從31:30開始)中描述。
有人能告訴我在Visual Studio 2012中實現委託構造函數的狀態嗎?或者我做錯了什麼?也許我的cl.exe命令?或者我需要安裝一些CTP編譯器或其他東西?
或者什麼。它在你的鏈接中非常明確地提到,支持它的編譯器版本是CTP版本。 VS2013預覽版也剛剛上市,可能在秋季的某個地方發佈。 –
您需要安裝2012年11月的CTP或更高版本。或者下載V2013預覽。 –