Compiler Error C2693
TOC
Collapse the table of content
Expand the table of content
This documentation is archived and is not being maintained.

Compiler Error C2693

Error Message

'operator' : illegal comparison for references to a managed array

You cannot test a managed array for any kind of inequality. For example, you can test to see if managed arrays are equal but you cannot test to see if one array is greater or less than another array.

For example, the following sample generates C2693:

// C2693.cpp
// compile with: /clr /c

int func3(array<int> ^a, array<int> ^b) {
   return a < b;   // C2693
}
int func1(array<int> ^a, array<int> ^b) {
   return a != b;   // OK
}
int func2(array<int> ^a, array<int> ^b) {
   return a == b;   // OK
}

Managed Extensions for C++

You cannot test a __gc array for any kind of inequality. For example, you can test to see if managed arrays are equal but you cannot test to see if one array is greater or less than another array.

The following sample generates C2693:

// C2693b.cpp
// compile with: /clr:oldSyntax /c
#using <mscorlib.dll>
int func3(int a __gc[], int b __gc[]) {
   return a < b;    // C2693
}
int func1(int a __gc[], int b __gc[]) {
   return a != b;   // OK
}

int func2(int a __gc[], int b __gc[]) {
   return a == b;   // OK
}
Show:
© 2016 Microsoft