Hi Jason,

On 5 Nov 2024, at 1:23, Jason Merrill wrote:

> On 11/4/24 10:19 AM, Simon Martin wrote:
>> Hi Jason,
>>
>> On 1 Nov 2024, at 16:31, Jason Merrill wrote:
>>
>>> On 11/1/24 5:07 AM, Simon Martin wrote:
>>>> Since r10-3793-g1a37b6d9a7e57c, we ICE upon the following valid 
>>>> code
>>>> with -std=c++17 and above
>>>>
>>>> === cut here ===
>>>> struct Base {
>>>>     unsigned int *intarray;
>>>> };
>>>> template <typename T> struct Sub : public Base {
>>>>     bool Get(int i) {
>>>>       return (Base::intarray[++i] == 0);
>>>>     }
>>>> };
>>>> === cut here ===
>>>>
>>>> The problem is that from c++17 on, we use -fstrong-eval-order and
>>>> need
>>>> to wrap the array access expression into a SAVE_EXPR, and end up
>>>> calling
>>>> contains_placeholder_p with a SCOPE_REF, that it does not handle
>>>> well.
>>>>
>>>> This patch fixes this by skipping the first operand of SCOPE_REFs 
>>>> in
>>>> contains_placeholder_p.
>>>
>>> Code in gcc/ shouldn't refer to tree codes from cp-tree.def.
>>>
>>> We probably shouldn't do the strong-eval-order transformation when
>>> processing_template_decl anyway.
>> Thanks, that makes sense. The attached updated patch skips the
>> wrapping when processing_template_decl, and also adds a test
>> case checking that -fstrong-eval-order processing is properly
>> done for instantiated templates.
>>
>> Successfully tested on x86_64-pc-linux-gnu. OK for trunk?
>
> OK.
Thanks, pushed to trunk as r15-4957-gb1d92aeb8583c8.

Since it’s a reject-valid regression, OK to back port to active 
branches as well?

Thanks, Simon

Reply via email to