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

Pure virtual call behaviour difference between VS and ICC

$
0
0

Hi,

The following code works if compiled with VS but fails with ICC:

class A {
public:
	  virtual void F() = 0;
};

class B : public A {
public:
	  virtual void F() = 0;
};

class C : public B  {
public:
	  virtual void B::F() override {}
};

int _tmain(int argc, _TCHAR* argv[])
{
	  C c;
	  A* a = &c;
	  a->F();
	  return 0;
}

Obviously, removing the 2nd F declaration in B or the "B::" part from F’s definition in C will remove the issue.

What I was wondering is whether this is a bug or just a quirk and of which of the compilers?

 


Viewing all articles
Browse latest Browse all 1616

Trending Articles



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