Quantcast
Channel: Intel® C++ Compiler
Viewing all articles
Browse latest Browse all 1616

access violation error when compiling specific source code

$
0
0

Hi everyone!

I got this issue when compiling my code, and I have minimized it into a several-line demonstration:

struct Obj
{
    Obj() = default;
    Obj( const Obj& ) = default;
    Obj& operator=( const Obj&) = default;
    ~Obj() = default; // <-- delete this fun and everything works. but how??
};

template <typename Type>
class TestType
{
public:
    void foo( Type valueToCompare ) {}
};


int main()
{
    TestType<Obj> obj;
    obj.foo(  Obj() );
    return 1;
}

This would cause a "error : access violation void foo( Type valueToCompare ) {}" during compiling. And if you remove the default destructor specification, the error would mysteriously disappear.

I'm using ICC 2015 update 4.


Viewing all articles
Browse latest Browse all 1616

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>