Re: [PATCH v3] c++: Adjust constexpr covariant call results [PR126324]

Jason Merrill <[email protected]>
Newsgroups gmane.comp.gcc.patches
Message-ID <[email protected]>
On 8/14/26 6:08 PM, Odysseas Georgoudis wrote:
>    Hi Jason,
> 
>    Thanks. Attached is v3 with the requested changes: the commit message is
>    wrapped at 76 columns, the test is renamed, and the type check now uses
>    INDIRECT_TYPE_P with the additional parentheses.
> 
>    I kept the type guard because this adjustment is specifically for 
> covariant
>    pointer or reference returns.  I also rebased onto current master.
> 
>    Tested on x86_64-pc-linux-gnu with no unexpected constexpr or consteval
>    test failures.

Pushed, thanks!
>    Thanks,
>    Odysseas
> ------------------------------------------------------------------------
> *From:* Jason Merrill <[email protected]>
> *Sent:* 14 August 2026 18:57
> *To:* Odysseas Georgoudis <[email protected]>; [email protected] 
> <[email protected]>
> *Subject:* Re: [PATCH v2] c++: Adjust constexpr covariant call results 
> [PR126324]
> On 7/26/26 5:15 PM, Odysseas Georgoudis wrote:
>> Hi Jason,
>> 
>> Thanks for catching the non-zero-offset case.
>> In v2, the result-thunk path now preserves null pointers,
>> evaluates the call only once, and adjusts the result to
>> the thunk’s static return type.
>> 
>> The test covers both zero- and non-zero-offset bases.
> Looks good, just a few tweaks.
> 
>> pointers, evaluate the call only once, and give the result the thunk's static
>>        * constexpr.cc (cxx_eval_thunk_call): Preserve null pointer results and
> These lines are too long; the commit message should wrap at column 76 to
> accommodate 'git log' adding 4 spaces on the left.
> 
>>        * g++.dg/cpp2a/pr126324.C: New test.
> 
> Let's add "constexpr-virtual" to the filename, i.e.
> constexpr-virtual-pr126324.C
> 
>> +      && scalarish_type_p (TREE_TYPE (t))
> 
> Let's use INDIRECT_TYPE_P since a covariant return type will be pointer
> or reference.  Or drop this line entirely; is it needed?
> 
>> +      && !same_type_ignoring_top_level_qualifiers_p
>> +        (TREE_TYPE (result), TREE_TYPE (t)))
> 
> This needs another set of parens starting either before or after the !
> to prevent emacs from moving the args to line up with the &&.
> 
> Jason
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.