This is the mail archive of the
gcc-prs@gcc.gnu.org
mailing list for the GCC project.
c++/4093: Return type mis-match for (a?b:c) constructs in gcc/cp/cp-tree.h
- To: gcc-gnats at gcc dot gnu dot org
- Subject: c++/4093: Return type mis-match for (a?b:c) constructs in gcc/cp/cp-tree.h
- From: rkl at connect dot org dot uk
- Date: 23 Aug 2001 14:13:18 -0000
- Reply-To: rkl at connect dot org dot uk
>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: