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;
}

One thought on “

Leave a comment