Patch Detail
Show a patch.
GET /api/1.1/patches/10236/?format=api
{ "id": 10236, "url": "https://patchwork.libcamera.org/api/1.1/patches/10236/?format=api", "web_url": "https://patchwork.libcamera.org/patch/10236/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/1.1/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20201025160434.25664-2-jacopo@jmondi.org>", "date": "2020-10-25T16:04:21", "name": "[libcamera-devel,v5,01/14] libcamera: controls: Disable ControlValue<T> construction from unsupported T", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "112887da7188f5958996e13bd3a6d036ec5e154e", "submitter": { "id": 3, "url": "https://patchwork.libcamera.org/api/1.1/people/3/?format=api", "name": "Jacopo Mondi", "email": "jacopo@jmondi.org" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/10236/mbox/", "series": [ { "id": 1414, "url": "https://patchwork.libcamera.org/api/1.1/series/1414/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1414", "date": "2020-10-25T16:04:20", "name": "libcamera: Introduce draft controls", "version": 5, "mbox": "https://patchwork.libcamera.org/series/1414/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/10236/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/10236/checks/", "tags": {}, "headers": { "Return-Path": "<libcamera-devel-bounces@lists.libcamera.org>", "X-Original-To": "parsemail@patchwork.libcamera.org", "Delivered-To": "parsemail@patchwork.libcamera.org", "Received": [ "from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id EE47BBDB13\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSun, 25 Oct 2020 16:04:44 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id CB63F61E4B;\n\tSun, 25 Oct 2020 17:04:44 +0100 (CET)", "from relay10.mail.gandi.net (relay10.mail.gandi.net\n\t[217.70.178.230])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 878E861E01\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun, 25 Oct 2020 17:04:42 +0100 (CET)", "from uno.lan (2-224-242-101.ip172.fastwebnet.it [2.224.242.101])\n\t(Authenticated sender: jacopo@jmondi.org)\n\tby relay10.mail.gandi.net (Postfix) with ESMTPSA id 8985F240003;\n\tSun, 25 Oct 2020 16:04:41 +0000 (UTC)" ], "From": "Jacopo Mondi <jacopo@jmondi.org>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Sun, 25 Oct 2020 17:04:21 +0100", "Message-Id": "<20201025160434.25664-2-jacopo@jmondi.org>", "X-Mailer": "git-send-email 2.28.0", "In-Reply-To": "<20201025160434.25664-1-jacopo@jmondi.org>", "References": "<20201025160434.25664-1-jacopo@jmondi.org>", "MIME-Version": "1.0", "Subject": "[libcamera-devel] [PATCH v5 01/14] libcamera: controls: Disable\n\tControlValue<T> construction from unsupported T", "X-BeenThere": "libcamera-devel@lists.libcamera.org", "X-Mailman-Version": "2.1.29", "Precedence": "list", "List-Id": "<libcamera-devel.lists.libcamera.org>", "List-Unsubscribe": "<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>", "List-Archive": "<https://lists.libcamera.org/pipermail/libcamera-devel/>", "List-Post": "<mailto:libcamera-devel@lists.libcamera.org>", "List-Help": "<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>", "List-Subscribe": "<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>", "Content-Type": "text/plain; charset=\"us-ascii\"", "Content-Transfer-Encoding": "7bit", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\nThe ControlValue<T> constructor for non-array values is a template\nfunction that participates in overload resolution for all T types that\nare not Span or std::string. Other T types that are not supported then\nresult in a compilation error.\n\nThis causes issues when calling an overloaded function that can accept\nboth a ControlValue and a Span with an std::array<U> parameter. The\nfirst overload will be resolved using implicit construction of a\nControlValue from the std::array<U>, while the second overload will be\nresolved using implicit construction of a Span<U> from the\nstd::array<U>. This results in a compilation error due to an ambiguous\nfunction call.\n\nThe first overload is invalid, selecting it would result in a\ncompilation error in the ControlValue constructor, as the\nControlValue<T> constructor doesn't support std::array<U> for type T.\nThe compiler can't know about that, as overload resolution happens\nearlier.\n\nTo fix it, we can disable the ControlValue<T> constructor for\nunsupported types T, moving the type check from compilation of the\nfunction to overload resolution. The constructor will not participate in\noverload resolution, and the call won't be ambiguous. The end result is\nthe same for unsupported types, compilation will fail.\n\nReviewed-by: Jacopo Mondi <jacopo@jmondi.org>\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n include/libcamera/controls.h | 1 +\n 1 file changed, 1 insertion(+)", "diff": "diff --git a/include/libcamera/controls.h b/include/libcamera/controls.h\nindex 80944efc133a..a556328cd188 100644\n--- a/include/libcamera/controls.h\n+++ b/include/libcamera/controls.h\n@@ -96,6 +96,7 @@ public:\n \n #ifndef __DOXYGEN__\n \ttemplate<typename T, typename std::enable_if_t<!details::is_span<T>::value &&\n+\t\t\t\t\t\t details::control_type<T>::value &&\n \t\t\t\t\t\t !std::is_same<std::string, std::remove_cv_t<T>>::value,\n \t\t\t\t\t\t std::nullptr_t> = nullptr>\n \tControlValue(const T &value)\n", "prefixes": [ "libcamera-devel", "v5", "01/14" ] }