C++相談室 part18
■ このスレッドは過去ログ倉庫に格納されています
0080デフォルトの名無しさん
NGNGstruct B {};
struct D : B {};
int main() {
std::auto_ptr<D> bp6(std::auto_ptr<B>());
//bp6.reset();
return 0;
}
gcc(3.2.2,2.9.5とも)でこれをコンパイルすると通る上に、//の
部分のコメントを外すと
hoge.cc: In function `int main()':
hoge.cc:8: request for member `reset' in `p', which is of non-aggregate
type `auto_ptr<D> ()(auto_ptr<B> (*)())'
とか言われるんだけど、これってバグだよね?
ちなみに
std::auto_ptr<D> bp6(std::auto_ptr<B>(0));
だと予想通りの挙動になる。
■ このスレッドは過去ログ倉庫に格納されています