VC7.1付属のSTLのauto_ptrのバグ

  • 以下のコードのように、コピー(Move)するauto_ptrのelement_typeが異なるとoperator auto_ptr_ref<_Other>()が無限に再帰してスタックがとぶ
    • どうもauto_ptr_refのコピーコンストラクタを呼ぶために再びこれが呼ばれるようだ
    • コンパイラのバグではなくSTLのバグと思われる
  • VC8付属のものは直っている

[]#include[] []<memory>[] []// auto_ptr[]
[]std[][]::[][]auto_ptr[][]<[][]int[][]> [][]new_int[][]()[]
[]{[]
[]return[] []std[][]::[][]auto_ptr[][]<[][]int[][]>([][]new[] []int[][]());[]
[]}[]


[]void[] []test[][]()[]
[]{[]
[]std[][]::[][]auto_ptr[][]<[][]int[] []const[][]> [][]ap[][](::[][]new_int[][]());[]
[]}[]