コンパイラのバグ?auto x0 = {std::shared_ptr<A>(new A("XXX"))};の動作がおかしい
先日VS2013previewをいそいそとインスコってお楽しみしてたのですがこんなバグ(?)に引っかかりまして……
ちょいとこのプログラムを脳内コンパイルの後コンパイルしてほしい
class A
{
public :
A(const std::string&x)
:str(x)
{}
void f(){std::cout << str<<std::endl;}
private:
std::string str;
};
int main()
{
auto x0 = {std::shared_ptr<A>(new A("XXX"))};
for (auto&x : x0)
x->f();
}
予想される 実行結果は
XXX
なのだが実際に実行すると例外を吐く。なにこれ怖い
intとかではこの問題発生しないし……なんなのなんなの?
//14/3/7 VS2013previewであることを明確にした