On 8/28/20 12:45 PM, Patrick Palka wrote:
(Removing libstd...@gcc.gnu.org from CC list)
On Fri, 28 Aug 2020, Patrick Palka wrote:
In resolve_address_of_overloaded_function, currently only the second
pass over the overload set (which considers just the function templates
in the overload set) checks constraints and performs return type
deduction when necessary. But as the testcases below show, we need to
do this when considering non-template functions during the first pass,
too.
Tested on x86_64-pc-linux-gnu, does this look OK for trunk?
gcc/cp/ChangeLog:
PR c++/96647
* class.c (resolve_address_of_overloaded_function): Also check
constraints and perform return type deduction when considering
non-template functions in the overload set.
gcc/testsuite/ChangeLog:
PR c++/96647
* g++.dg/cpp0x/auto-96647.C: New test.
* g++.dg/cpp2a/concepts-fn6.C: New test.
---
gcc/cp/class.c | 16 ++++++++++++++++
gcc/testsuite/g++.dg/cpp0x/auto-96647.C | 10 ++++++++++
gcc/testsuite/g++.dg/cpp2a/concepts-fn6.C | 10 ++++++++++
3 files changed, 36 insertions(+)
create mode 100644 gcc/testsuite/g++.dg/cpp0x/auto-96647.C
create mode 100644 gcc/testsuite/g++.dg/cpp2a/concepts-fn6.C
+ if (undeduced_auto_decl (fn))
+ {
+ /* Force instantiation to do return type deduction. */
+ ++function_depth;
+ instantiate_decl (fn, /*defer*/false, /*class*/false);
+ --function_depth;
How about maybe_instantiate_decl instead of this hunk? This looks like
it could call instantiate_decl for a non-template function, which is wrong.
Jason