PING [PATCH v2] c++: Fix constrained auto deduction templ parms resolution [PR114915, PR115030]

2024-09-04 Thread Seyed Sajad Kahani
I'm gently pinging about the patch I submitted: https://gcc.gnu.org/pipermail/gcc-patches/2024-August/660177.html This patch was created in response to Jason's comments here: https://gcc.gnu.org/pipermail/gcc-patches/2024-July/657739.html I appreciate your time and consideration. Thank you.

[PATCH v2] c++: Fix constrained auto deduction templ parms resolution [PR114915, PR115030]

2024-08-12 Thread Seyed Sajad Kahani
When deducing auto for `adc_return_type`, `adc_variable_type`, and `adc_decomp_type` contexts (at the usage time), we try to resolve the outermost template arguments to be used for satisfaction. This is done by one of the following, depending on the scope: 1. Checking the `DECL_TEMPLATE_INFO` of t

[PATCH] c++: Fix constrained auto deduction templ parms resolution [PR114915, PR115030]

2024-08-11 Thread Seyed Sajad Kahani
When deducing auto for `adc_return_type`, `adc_variable_type`, and `adc_decomp_type` contexts (at the usage time), we try to resolve the outermost template arguments to be used for satisfaction. This is done by one of the following, depending on the scope: 1. Checking the `DECL_TEMPLATE_INFO` of t

Re: [PATCH v6] c++: Fix constrained auto deduction in templ spec scopes [PR114915]

2024-08-11 Thread Seyed Sajad Kahani
wrote: > On 7/18/24 12:03 PM, Seyed Sajad Kahani wrote: > > When deducing auto for `adc_return_type`, `adc_variable_type`, and > > `adc_decomp_type` contexts (at the usage time), we try to resolve > > the outermost > > template arguments to be used for satisfaction. Thi

Re: [RFC] c++: Eagerly substitute auto constraint args in tsubst [PR115030]

2024-07-18 Thread Seyed Sajad Kahani
On Wed, 2024-07-17 at 15:48 -0400, Patrick Palka wrote: > > I guess you mean B here? > Yes. Apologies for my mistake. > Ah, that's because the substitution failure in the first example > occurs > during constraint _normalization_, and in second example it occurs > during atomic constraint _sat

[PATCH v6] c++: Fix constrained auto deduction in templ spec scopes [PR114915]

2024-07-18 Thread Seyed Sajad Kahani
When deducing auto for `adc_return_type`, `adc_variable_type`, and `adc_decomp_type` contexts (at the usage time), we try to resolve the outermost template arguments to be used for satisfaction. This is done by one of the following, depending on the scope: 1. Checking the `DECL_TEMPLATE_INFO` of t

[PATCH v3] c++: Hash placeholder constraint in ctp_hasher

2024-07-18 Thread Seyed Sajad Kahani
This patch addresses a difference between the hash function and the equality function for canonical types of template parameters (ctp_hasher). The equality function uses comptypes (typeck.cc) (with COMPARE_STRUCTURAL) and checks constraint equality for two auto nodes (typeck.cc:1586), while the has

[PATCH v2] c++: Hash placeholder constraint in ctp_hasher

2024-07-17 Thread Seyed Sajad Kahani
This patch addresses a difference between the hash function and the equality function for canonical types of template parameters (ctp_hasher). The equality function uses comptypes (typeck.cc) (with COMPARE_STRUCTURAL) and checks constraint equality for two auto nodes (typeck.cc:1586), while the has

Re: [PATCH v1] c++: Hash placeholder constraint in ctp_hasher

2024-07-17 Thread Seyed Sajad Kahani
On Tue, 16 Jul 2024 at 17:05, Jason Merrill wrote: > The change looks good, just a couple of whitespace tweaks needed. But > what happened to the testcase? I was unable to design any testcase that differs by applying this patch, due to the proper handling of hash collisions (hash-table.h:1059).

Re: [RFC] c++: Eagerly substitute auto constraint args in tsubst [PR115030]

2024-07-13 Thread Seyed Sajad Kahani
ddition to these changes, we also need to modify constraint_satisfaction_value (constraints.cc) as well to raise an error for the static_assert and other usages of concept expressions as well. On Fri, 12 Jul 2024 at 21:31, Patrick Palka wrote: > > Interesting, thanks for the detailed write

Re: [PATCH v1] c++: Hash placeholder constraint in ctp_hasher

2024-07-12 Thread Seyed Sajad Kahani
I am sorry for the inconvenience, a fixed version was sent just now.

[PATCH v1] c++: Hash placeholder constraint in ctp_hasher

2024-07-12 Thread Seyed Sajad Kahani
This patch addresses a difference between the hash function and the equality function for canonical types of template parameters (ctp_hasher). The equality function uses comptypes (typeck.cc) (with COMPARE_STRUCTURAL) and checks constraint equality for two auto nodes (typeck.cc:1586), while the has

[PATCH v1] c++: Hash placeholder constraint in ctp_hasher

2024-07-09 Thread Seyed Sajad Kahani
9 Jul 2024 at 14:41, Seyed Sajad Kahani wrote: > > Hi. > > While investigating a fix for C++/PR115030 (a bug in constrained auto > deduction), I was wondering why we are not substituting constraint args of an > auto node in tsubst (pt.cc:16533). Instead, this substitution is del

[PATCH v1] c++: Eagerly substitute auto constraint args in tsubst [PR115030]

2024-07-09 Thread Seyed Sajad Kahani
This patch addresses a bug in constrained auto deduction (C++/PR115030) by modifying tsubst to eagerly substitute the constraint args of an auto node. This change avoids the complexity of finding outer_targs during do_auto_deduction. Note that outer_targs cannot be completely removed but will be s

[RFC] c++: Eagerly substitute auto constraint args in tsubst [PR115030]

2024-07-09 Thread Seyed Sajad Kahani
Hi. While investigating a fix for C++/PR115030 (a bug in constrained auto deduction), I was wondering why we are not substituting constraint args of an auto node in tsubst (pt.cc:16533). Instead, this substitution is delayed until do_auto_deduction (pt.cc), where we attempt to find the substituted

[PATCH v5] c++: fix constained auto deduction in templ spec scopes [PR114915]

2024-06-14 Thread Seyed Sajad Kahani
When deducing auto for `adc_return_type`, `adc_variable_type`, and `adc_decomp_type` contexts (at the usage time), we try to resolve the outermost template arguments to be used for satisfaction. This is done by one of the following, depending on the scope: 1. Checking the `DECL_TEMPLATE_INFO` of t

[PATCH v4] c++: fix constained auto deduction in templ spec scopes [PR114915]

2024-05-15 Thread Seyed Sajad Kahani
This patch resolves PR114915 by replacing the logic that fills in the missing levels in do_auto_deduction in cp/pt.cc. The new approach now trims targs if the depth of targs is deeper than desired (this will only happen in specific contexts), and still fills targs with empty layers if it has fewer

[PATCH v3] Fix auto deduction for template specialization scopes [PR114915]

2024-05-10 Thread Seyed Sajad Kahani
This patch resolves PR114915 by replacing the logic that fills in the missing levels in do_auto_deduction in cp/pt.cc. The new approach now trims targs if the depth of targs is deeper than desired (this will only happen in specific contexts), and still fills targs with empty layers if it has few

Re: [PATCH v2] Fix auto deduction for template specialization scopes [PR114915]

2024-05-10 Thread Seyed Sajad Kahani
Thanks for your suggestions. I will apply them in the upcoming patch (v3). On Mon, May 6, 2024 at 7:46 PM Patrick Palka wrote: > We could also/instead consider defining > > int want = TEMPLATE_TYPE_ORIG_LEVEL (auto_node); > int have = TMPL_ARGS_DEPTH (full_targs); > > and express the logic in ter

[PATCH v2] Fix auto deduction for template specialization scopes [PR114915]

2024-05-04 Thread Seyed Sajad Kahani
The limitations of the initial patch (checking specializiation template usage), have been discussed. > I realized that for the case where we have a member function template > of a class template, and a specialization of the enclosing class only > (like below), > > template <> > template > void S

Re: [PATCH] Fix auto deduction for template specialization scopes [114915].

2024-05-04 Thread Seyed Sajad Kahani
Thanks for your helpful feedback. It has totally shaped my understanding. While I was trying to develop other tests, as you suggested: > It would be good to also test an explicit variable tmpl spec and > an explicit spec of a member template of a class template. I realized that for the case wher

[PATCH] Fix auto deduction for template specialization scopes [114915].

2024-05-01 Thread Seyed Sajad Kahani
When deducing auto for `adc_return_type`, `adc_variable_type`, and `adc_decomp_type` contexts (at the usage time), we try to resolve the outermost template arguments to be used for satisfaction. This is done by one of the following, depending on the scope: 1. Checking the `DECL_TEMPLATE_INFO` o