auto_ptr MSVC6.0 and Intel8.0

auto_ptr MSVC6.0 and Intel8.0

I found something strange when I went from the Intel 7.1 compiler to the Intel 8.0 compiler and I am not sure if it is a bug or not.

Assume I have a class named Foo with a method blah. The following code compiles in version 7.1.

#include "stdio.h"

#include "memory"

#include "foo.h"

int main( int argc, char argv[] )


Foo* firstFoo = new Foo();


std::auto_ptr< Foo > autoFoo = new Foo();



But under 8.0 I get the following error:

C:SandboxAutoPtrTestmain.cpp(12): error: no suitable constructor exists to convert from "Foo *" to "std::auto_ptr< Foo >" std::auto_ptr< Foo > autoFoo = new Foo();

Has anyone else seen this? By the way, the code compiles if I change the line to:

std::auto_ptr< Foo > autoFoo( new Foo() );


Matt Fleming

Message Edited by Matthew-Fleming2 on 01-28-2004 08:00 AM

Message Edited by Matthew-Fleming2 on 01-28-2004 08:01 AM

3 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

I believe the 2nd form that you have where the new is inside the parentheses is more standards conforming, the previous version that you have is not standards compliant - though it may have been in previous releases of the compiler.

Maybe you're using an older version of 7.1, the latest version gives the same error. I don't think it's a bug in 8.0. CComPtr<> works that way.


Leave a Comment

Please sign in to add a comment. Not a member? Join today