[PATCH] c++: Don't ICE in build_class_member_access_expr during error recovery [PR118225]
Simon Martin
simon@nasilyan.com
Tue Jan 21 12:40:17 GMT 2025
Hi Jason,
On 20 Jan 2025, at 22:50, Jason Merrill wrote:
> On 1/4/25 10:13 AM, Simon Martin wrote:
>> The invalid case in this PR trips on an assertion in
>> build_class_member_access_expr that build_base_path would never
>> return
>> an error_mark_node, which is actually incorrect if the object
>> involves a
>> tree with an error_mark_node DECL_INITIAL, like here.
>>
>> This patch simply removes the assertion, even though it has been here
>> for 22+ years (r0-44513-g50ad96428042fa). An alternative would be to
>> assert that object != error_mark_node || seen_error (), but that'd be
>> virtually not asserting anything IMO.
>
> That is an important difference: it asserts that if we run into
> trouble, we've actually given an error message. Silently ignoring
> error_mark_node frequently leads to wrong-code bugs.
That makes sense, thanks for the context.
> OK with that change.
Thanks, applied as r15-7096-g4e4c378ac1f923.
Simon
More information about the Gcc-patches
mailing list