diff options
author | Jason Merrill <jason@redhat.com> | 2017-02-28 18:57:09 -0500 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2017-02-28 18:57:09 -0500 |
commit | 853ef4e5632df32894b2366096c1ae1ef4ba03df (patch) | |
tree | 9c3a71f0fc9f1269321ec72fd50dd34bf67987ef /gcc/cp/call.c | |
parent | ad1de65225fc1ac05fe6b05b6198dc50a51e4935 (diff) | |
download | gcc-853ef4e5632df32894b2366096c1ae1ef4ba03df.zip gcc-853ef4e5632df32894b2366096c1ae1ef4ba03df.tar.gz gcc-853ef4e5632df32894b2366096c1ae1ef4ba03df.tar.bz2 |
Class template argument deduction refinements
* call.c (joust): Move deduction guide tiebreaker down.
* decl.c (start_decl_1, cp_finish_decl, grokdeclarator): Allow class
deduction with no initializer.
* pt.c (build_deduction_guide): Handle implicit default/copy ctor.
(do_class_deduction): Use that rather than special case.
(do_auto_deduction): Handle null initializer.
From-SVN: r245796
Diffstat (limited to 'gcc/cp/call.c')
-rw-r--r-- | gcc/cp/call.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 560804a..babab00 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -9670,18 +9670,6 @@ joust (struct z_candidate *cand1, struct z_candidate *cand2, bool warn, return winner; } - /* F1 is generated from a deduction-guide (13.3.1.8) and F2 is not */ - if (deduction_guide_p (cand1->fn)) - { - gcc_assert (deduction_guide_p (cand2->fn)); - /* We distinguish between candidates from an explicit deduction guide and - candidates built from a constructor based on DECL_ARTIFICIAL. */ - int art1 = DECL_ARTIFICIAL (cand1->fn); - int art2 = DECL_ARTIFICIAL (cand2->fn); - if (art1 != art2) - return art2 - art1; - } - /* or, if not that, F1 is a non-template function and F2 is a template function specialization. */ @@ -9719,6 +9707,18 @@ joust (struct z_candidate *cand1, struct z_candidate *cand2, bool warn, return winner; } + /* F1 is generated from a deduction-guide (13.3.1.8) and F2 is not */ + if (deduction_guide_p (cand1->fn)) + { + gcc_assert (deduction_guide_p (cand2->fn)); + /* We distinguish between candidates from an explicit deduction guide and + candidates built from a constructor based on DECL_ARTIFICIAL. */ + int art1 = DECL_ARTIFICIAL (cand1->fn); + int art2 = DECL_ARTIFICIAL (cand2->fn); + if (art1 != art2) + return art2 - art1; + } + /* or, if not that, F2 is from a using-declaration, F1 is not, and the conversion sequences are equivalent. (proposed in http://lists.isocpp.org/core/2016/10/1142.php) */ |