From mboxrd@z Thu Jan 1 00:00:00 1970 From: rkl@connect.org.uk To: gcc-gnats@gcc.gnu.org Subject: c++/4093: Return type mis-match for (a?b:c) constructs in gcc/cp/cp-tree.h Date: Thu, 23 Aug 2001 07:16:00 -0000 Message-id: <20010823141318.6275.qmail@sourceware.cygnus.com> X-SW-Source: 2001-08/msg00586.html List-Id: >Number: 4093 >Category: c++ >Synopsis: Return type mis-match for (a?b:c) constructs in gcc/cp/cp-tree.h >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: sw-bug >Submitter-Id: net >Arrival-Date: Thu Aug 23 07:16:01 PDT 2001 >Closed-Date: >Last-Modified: >Originator: rkl@connect.org.uk >Release: unknown-1.0 >Organization: >Environment: HP-UX 11.00 (may apply to other platforms with "strict" ANSI C compilers) >Description: HP-UX's ANSI C compiler likes the conditional (a?b:c) construct to have matching types for the return values b and c (which is sensible, you'd agree :-) ). In gcc/cp/cp-tree.h, there is a mismatch in the #define's for SET_BINFO_MARKED(), CLEAR_BINFO_MARKED(), SET_BINFO_VTABLE_PATH_MARKED() and CLEAR_BINFO_VTABLE_PATH_MARKED() (lines 1668, 1669, 1674 and 1675). It turns out that the "true" part ("b" if you like) returns a (void), but the "false" part ("c") doesn't. >How-To-Repeat: Compile gcc 3.0.1 with a strict ANSI C compiler - I used the HP-UX 11.00 HP ANSI C compiler for this. >Fix: Cast the "else" part ("c") to a (void). For example: #define SET_BINFO_MARKED(NODE) (TREE_VIA_VIRTUAL(NODE)?SET_CLASSTYPE_MARKED(BINFO_TYPE(NODE)):(void)(TREE_LANG_FLAG_0(NODE)=1)) >Release-Note: >Audit-Trail: >Unformatted: