RSS
Follow Us
Contribute
 
 
 
 

Error C2451: conditional expression of type (type) is illegal

 
We need YOUR SKILLS in this collaborative work, to build the largest solution center for error messages.

From $1

Table of contents
  1. 1. Cause
  2. 2. Solution
  3. 3. About This Article

Cause

The conditional expression evaluates to an integer type. Ex:

class B {};

int main () {
   B b1;
   int i = 0;
   if (b1)   // C2451
      ;

Solution

Possible resolution:

class B {};

int main () {
   B b1;
   int i = 0
   if (i)
      ;

About This Article

This article is a derivative work based on Compiler Error C2451 which is provided by MSDN Community Content - Visual C++.

 
 
 
 
Comments