> > actually allocated to the thing.
>
> ... and only if ENABLE_TREE_CHECKING enabled (which by default is off, imho)
Uh, no it's not off by default, unless you are on a release branch or
configuring with --disable-checking.
On development builds, tree checking is on by default.
> There is no way in C to tell the number of args to vararg function.
> So build_* stuff is doing its best already.
>
> >> I guess that sort of assertions need at least a comment or gcc_assert().
> > My suggestion would be to simply add some gcc_asserts that we don't ever
> > get
> > ARRAY_REF there :)
>
> That's exactly my point. If such bad init happens, it will be
> difficult to spot (unless you doing pch).
> How about:
> *** cp/typeck.c Wed Mar 8 18:55:49 2006
> --- cp/typeck.c.new Wed Apr 19 23:28:15 2006
> *************** build_x_binary_op (enum tree_code code,
> *** 2697,2702 ****
> --- 2697,2703 ----
>
> if (processing_template_decl)
> {
> + gcc_assert (TREE_CODE_CLASS (code) == tcc_binary);
> if (type_dependent_expression_p (arg1)
> || type_dependent_expression_p (arg2))
> return build_min_nt (code, arg1, arg2);
>
This is fine by me, but you need mark or another C++ fe approval.
I'd suggest writing up a changelog, and submitting a new email with a
subject like "[PATCH] Add assert to cp/typeck.c build_x_binary_op" to
try to grab a C++ person's attention.
Or just copy one of the listed C++ maintainers on the email :)