{"id":807336,"url":"http://patchwork.ozlabs.org/api/patches/807336/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/patch/CAFk2RUZ+yx4ftYzL5g36B90-k_4tG2ahqKJ5ZC9ouxteLkvtEQ@mail.gmail.com/","project":{"id":17,"url":"http://patchwork.ozlabs.org/api/projects/17/?format=json","name":"GNU Compiler Collection","link_name":"gcc","list_id":"gcc-patches.gcc.gnu.org","list_email":"gcc-patches@gcc.gnu.org","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<CAFk2RUZ+yx4ftYzL5g36B90-k_4tG2ahqKJ5ZC9ouxteLkvtEQ@mail.gmail.com>","list_archive_url":null,"date":"2017-08-29T22:19:17","name":"[C++] Make taking the address of an overloaded function a non-deduced context","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"637986ecbecf2cf204edffee3908b8a864e343b5","submitter":{"id":5783,"url":"http://patchwork.ozlabs.org/api/people/5783/?format=json","name":"Ville Voutilainen","email":"ville.voutilainen@gmail.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/gcc/patch/CAFk2RUZ+yx4ftYzL5g36B90-k_4tG2ahqKJ5ZC9ouxteLkvtEQ@mail.gmail.com/mbox/","series":[{"id":495,"url":"http://patchwork.ozlabs.org/api/series/495/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/list/?series=495","date":"2017-08-29T22:19:17","name":"[C++] Make taking the address of an overloaded function a non-deduced context","version":1,"mbox":"http://patchwork.ozlabs.org/series/495/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/807336/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/807336/checks/","tags":{},"related":[],"headers":{"Return-Path":"<gcc-patches-return-461129-incoming=patchwork.ozlabs.org@gcc.gnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":["patchwork-incoming@bilbo.ozlabs.org","mailing list gcc-patches@gcc.gnu.org"],"Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org\n\t(client-ip=209.132.180.131; helo=sourceware.org;\n\tenvelope-from=gcc-patches-return-461129-incoming=patchwork.ozlabs.org@gcc.gnu.org;\n\treceiver=<UNKNOWN>)","ozlabs.org; dkim=pass (1024-bit key;\n\tunprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org\n\theader.b=\"MUFIokmn\"; dkim-atps=neutral","sourceware.org; auth=none"],"Received":["from sourceware.org (server1.sourceware.org [209.132.180.131])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xhjjf6VKKz9sN5\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed, 30 Aug 2017 08:19:32 +1000 (AEST)","(qmail 43541 invoked by alias); 29 Aug 2017 22:19:24 -0000","(qmail 43406 invoked by uid 89); 29 Aug 2017 22:19:22 -0000","from mail-ua0-f169.google.com (HELO mail-ua0-f169.google.com)\n\t(209.85.217.169) by sourceware.org\n\t(qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP;\n\tTue, 29 Aug 2017 22:19:20 +0000","by mail-ua0-f169.google.com with SMTP id g11so14254406uah.2 for\n\t<gcc-patches@gcc.gnu.org>; Tue, 29 Aug 2017 15:19:20 -0700 (PDT)","by 10.103.103.135 with HTTP; Tue, 29 Aug 2017 15:19:17 -0700 (PDT)"],"DomainKey-Signature":"a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender\n\t:mime-version:from:date:message-id:subject:to:content-type; q=\n\tdns; s=default; b=Pq6P6Q2lUa5U2QccvXDGNVRqPgtiT63ohG/uWmq1vtW8E8\n\tIUxlw7GLmTASpF/21faBZukNZXhM6QVc8o6R/vnH3xqxtFedAx3JDDyjYcG7IVc4\n\topfMBGehtXJmqmc4WCWyixJPwNYDcNSGO1RC872r6e/vprItv/uw6yN+e61zs=","DKIM-Signature":"v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender\n\t:mime-version:from:date:message-id:subject:to:content-type; s=\n\tdefault; bh=46elwaWPJQXYztb6rSK0Qg4YBRw=; b=MUFIokmnJxEpbltXMV04\n\tDzvqaDOKf/MkHnaBpzIXmO/kNAj35Sl5sshFgpNwrLLnN5sPLVzgV9TCcbOtJmkz\n\tSncvyCX27ASUpdU2aQzKPLongPlQyPjieNgmuE0Y2tKTMolXnCCnWdcwlp3BGqIV\n\t2auDpo8SMLkyxJGlz7PDwIc=","Mailing-List":"contact gcc-patches-help@gcc.gnu.org; run by ezmlm","Precedence":"bulk","List-Id":"<gcc-patches.gcc.gnu.org>","List-Unsubscribe":"<mailto:gcc-patches-unsubscribe-incoming=patchwork.ozlabs.org@gcc.gnu.org>","List-Archive":"<http://gcc.gnu.org/ml/gcc-patches/>","List-Post":"<mailto:gcc-patches@gcc.gnu.org>","List-Help":"<mailto:gcc-patches-help@gcc.gnu.org>","Sender":"gcc-patches-owner@gcc.gnu.org","X-Virus-Found":"No","X-Spam-SWARE-Status":"No, score=-23.9 required=5.0 tests=AWL, BAYES_00,\n\tFREEMAIL_FROM, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2,\n\tGIT_PATCH_3, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM,\n\tSPF_PASS autolearn=ham version=3.3.2 spammy=","X-HELO":"mail-ua0-f169.google.com","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net;\n\ts=20161025;\n\th=x-gm-message-state:mime-version:from:date:message-id:subject:to;\n\tbh=ODQ7W6FAIK5VGGoSctmSJNP4dZHbKKsD6SDJ4bFaMQo=;\n\tb=N6PnpYtvG9R9nLAr01B6g0Q8BPaXlGyG4OnNCMZlFor6fBV8I0UL4WRcRpf6+63Vxr\n\thm6e6oGZWmwZuyAaHKCAoR5uaN38PCwS7vIUvutYqCd/zjVG3L74/UN44fMr4FPd7WBR\n\tTv2idZ7DbLqb4rKBLMxgEsARKpjBNIW2FLqZh8OO3WgfGdOxR9wGnKXulxHN4aYFaWk6\n\tL9OkP4qj0ltpbyko0XBFj5JvtS6jzKJLx1lTsB2uJZa5G2WQ9qWPhMs8r+VgJIOywPMe\n\tdf3uo1jTFqAY876B3qId3GZACPOLM4sed52EHjin4j4YshcPdZzaWbkQ4lgNKQMxiZy0\n\t2hUA==","X-Gm-Message-State":"AHYfb5jEx5pLA1vjLvwyFNOxEAU++wuRzw/fjeVuuNvcvty84GBvsCfn\tUFx43YnloWejUKVAtRAJzP9frYixw8wC","X-Received":"by 10.176.71.235 with SMTP id w43mr1260836uac.65.1504045158391;\n\tTue, 29 Aug 2017 15:19:18 -0700 (PDT)","MIME-Version":"1.0","From":"Ville Voutilainen <ville.voutilainen@gmail.com>","Date":"Wed, 30 Aug 2017 01:19:17 +0300","Message-ID":"<CAFk2RUZ+yx4ftYzL5g36B90-k_4tG2ahqKJ5ZC9ouxteLkvtEQ@mail.gmail.com>","Subject":"[C++ PATCH] Make taking the address of an overloaded function a\n\tnon-deduced context","To":"\"gcc-patches@gcc.gnu.org\" <gcc-patches@gcc.gnu.org>,\n\tJason Merrill <jason@redhat.com>","Content-Type":"multipart/mixed; boundary=\"f4030437a2d4648c5b0557ebcd43\""},"content":"2017-08-29  Ville Voutilainen  <ville.voutilainen@gmail.com>\n\n    Make taking the address of an overloaded function a non-deduced context\n\n    cp/\n\n    * pt.c (unify_overload_resolution_failure): Return unify_success\n    instead of unify_invalid.\n\n    testsuite/\n\n    * g++.dg/overload/template6.C: New.","diff":"diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c\nindex 564ffb0..4f731fd 100644\n--- a/gcc/cp/pt.c\n+++ b/gcc/cp/pt.c\n@@ -6370,7 +6370,7 @@ unify_overload_resolution_failure (bool explain_p, tree arg)\n     inform (input_location,\n \t    \"  could not resolve address from overloaded function %qE\",\n \t    arg);\n-  return unify_invalid (explain_p);\n+  return unify_success (explain_p);\n }\n \n /* Attempt to convert the non-type template parameter EXPR to the\ndiff --git a/gcc/testsuite/g++.dg/overload/template6.C b/gcc/testsuite/g++.dg/overload/template6.C\nnew file mode 100644\nindex 0000000..f2650aa\n--- /dev/null\n+++ b/gcc/testsuite/g++.dg/overload/template6.C\n@@ -0,0 +1,47 @@\n+// { dg-do compile { target c++11 } }\n+\n+template <typename>\n+struct is_function {\n+  static constexpr bool value = false;\n+};\n+\n+template <typename R, typename ...Args>\n+struct is_function<R(Args...)>\n+{\n+  static constexpr bool value = true;\n+};\n+\n+template<bool, typename> struct enable_if {};\n+\n+template<typename T> struct enable_if<true, T> \n+{\n+  typedef T type;\n+};\n+\n+template <class T>\n+struct remove_pointer\n+{\n+  typedef T type;\n+};\n+\n+template <class T>\n+struct remove_pointer<T*>\n+{\n+  typedef T type;\n+};\n+\n+void f(int) {}\n+void f(double) {}\n+\n+template <class T>\n+struct X\n+{\n+  template <class U=T,\n+\t    typename enable_if<is_function<\n+\t\t\t\t typename remove_pointer<U>::type>::value,\n+\t\t\t       bool>::type = false> X(U&&) {}\n+};\n+\n+int main() {\n+  X<void(*)(int)> x0(f);\n+}\n","prefixes":["C++"]}