While the Intel® oneAPI DPC++/C++ Compiler is compatible with the Microsoft Visual C++* Compiler, some differences can prevent successful compilation. Also there can be some incompatible generated-code behavior of some source files with the Intel oneAPI DPC++/C++ Compiler. In most cases, a modification of the user source file enables successful compilation with both the Intel oneAPI DPC++/C++ Compiler and the Microsoft Visual C++ Compiler. The differences between the compilers are listed as follows:
This content is specific to C++; it does not apply to DPC++.
For compilations targeted for IA-32 architecture, inline assembly target labels of goto statements are case sensitive. The Microsoft Visual C++ compiler treats these labels in a case insensitive manner. For example, the Intel oneAPI DPC++/C++ Compiler issues an error when compiling the following code:
int func(int x) {
goto LAB2;
// error: label "LAB2" was referenced but not defined
__asm lab2: mov x, 1
return x;
}
However, the Microsoft Visual C++ Compiler accepts the preceding code. As a work-around for the Intel oneAPI DPC++/C++ Compiler, when a goto statement refers to a label defined in inline assembly, you must match the label reference with the label definition in both name and case.
The Intel oneAPI DPC++/C++ Compiler will attempt to inline any functions that are marked dllimport but Microsoft* will not. Therefore, any calls or variables used inside a dllimport routine needs to be available at link time or the result will be an unresolved symbol.
The following example contains two files: header.h and bug.cpp.
#ifndef _HEADER_H
#define _HEADER_H
namespace Foo_NS {
class Foo2 {
public:
Foo2(){};
~Foo2();
static int test(int m_i);
};
}
#endif
#include “header.h”
struct Foo2 {
static void test();
};
struct __declspec(dllimport) Foo
{
void getI() { Foo2::test(); };
};
struct C {
virtual void test();
};
void C::test() { Foo* p; p->getI(); }
int main() {
return 0;
}