Export (0) Print
Expand All
Expand Minimize

Compiler Warning (level 4) C4239

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

This type conversion is not allowed by the C++ draft 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.

Example

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

void func(void)
{
   // C4239: nonstandard extension used :
   // 'initializing' : conversion from 'struct C' to
   //'struct C&'
   // A reference that is not to 'const' cannot be bound
   // to a non-lvalue
   C & rC = C();   // C4239
}

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

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