Compiler Error C2422

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at Compiler Error C2422.

illegal segment override in 'operand'

Inline assembly code incorrectly uses a segment override operator (colon) on an operand. Possible causes include:

  • The register preceding the operator is not a segment register.

  • The register preceding the operator is not the only segment register in the operand.

  • The segment override operator appears within an indirection operator (brackets).

  • The expression following the segment override operator is not an immediate operand or a memory operand.

The following sample generates C2422:

// C2422.cpp  
// processor: x86  
int main() {  
   _asm {  
      mov AX, [BX:ES]   // C2422  
      mov AX, ES   // OK  
   }  
}  

Show: