This simple program with erroneous syntax compiles fine with GCC 2.95 and GCC 4.1.2 but is rejected by GCC 4.7.1 and all Microsoft C++ compilers (from ancient Visual C++ 6.0 up to VS 2010).

 

#include <memory>
class CBase 
{
    public:
        CBase(int a) { _a = a;}
    private:
        int _a;
};
 
int main()
{
    std::auto_ptr(new CBase::CBase(5));
    return 0;
}
Advertisements

One thought on “

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s