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 4) C4239

Error Message

nonstandard extension used : 'token' : conversion from 'type' to 'type'

This type conversion is not allowed by the C++ standard, but it is permitted here as an extension. This warning is always followed by at least one line of explanation describing the language rule being violated.


The following sample generates C4239.

// C4239.cpp
// compile with: /W4 /c
struct C {
   C() {}

void func(void) {
   C & rC = C();   // C4239
   const C & rC2 = C();   // OK

Conversion from integral type to enum type is not strictly allowed.

The following sample generates C4239.

// C4239b.cpp
// compile with: /W4 /c
enum E { value }; 
struct S { 
   E e : 2; 
} s = { 5 };   // C4239 
// try the following line instead
// } s = { (E)5 };

Community Additions

© 2015 Microsoft