Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Expand Minimize
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.

Compiler Warning (level 1) C4817

Error Message

'member' : illegal use of '.' to access this member; compiler replaced with '->'

The wrong member access operator was used.

Example

The following sample generates C4817.

// C4817.cpp
// compile with: /clr /W1
using namespace System;
int main() {
   array<Int32> ^ a = gcnew array<Int32>(100);
   Console::WriteLine( a.Length );   // C4817
   Console::WriteLine( a->Length );   // OK
}

C4817 can also be generated using /clr:oldSyntax. The following sample generates C4817.

// C4817_b.cpp
// compile with: /clr:oldSyntax /W1
using namespace System;
int main() {
   Int32 a[] = new Int32[11];
   Console::WriteLine( a.Length );
   // Console::WriteLine( a->Length );
}

Community Additions

ADD
Show:
© 2015 Microsoft