Condividi tramite


Avviso del compilatore (livello 4) C4239

estensione non standard usata: 'token': conversione da 'type' a 'type'

Questa conversione del tipo non è consentita dallo standard C++, ma è consentita qui come estensione. Questo avviso è sempre seguito da almeno una riga di spiegazione che descrive la regola del linguaggio violata.

Esempi

L'esempio seguente genera l'errore C4239.

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

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

La conversione dal tipo integrale al tipo enumerazione non è strettamente consentita.

L'esempio seguente genera l'errore 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 };