[Bug c++/14958] incorrect compile of ?:, specifically ptr = flag? class_obj: 0;

bangerth at dealii dot org gcc-bugzilla@gcc.gnu.org
Wed Apr 14 19:28:00 GMT 2004


------- Additional Comments From bangerth at dealii dot org  2004-04-14 18:54 -------
Indeed. First, the result 
type of any expression is independent of the type of the variable 
it is assigned to, so the conversion you proposed can't happen. 
Second, the type of one of the 2nd/3rd parameters to the ?: operator 
is converted to the type of the other one if possible. In your case, 
  flag? foo : 0 
is equivalent to 
  flag? foo : (foo)0 
with foo=tmparray<short>. 
 
W. 

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14958



More information about the Gcc-bugs mailing list