Patch Detail
Show a patch.
GET /api/patches/10232/?format=api
{ "id": 10232, "url": "https://patchwork.libcamera.org/api/patches/10232/?format=api", "web_url": "https://patchwork.libcamera.org/patch/10232/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/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": "<20201023220020.22536-1-laurent.pinchart@ideasonboard.com>", "date": "2020-10-23T22:00:20", "name": "[libcamera-devel] libcamera: controls: Disable ControlValue<T> construction from unsupported T", "commit_ref": "581bb274956fcf7e781384342e88cd8fa35b1336", "pull_url": null, "state": "accepted", "archived": false, "hash": "112887da7188f5958996e13bd3a6d036ec5e154e", "submitter": { "id": 2, "url": "https://patchwork.libcamera.org/api/people/2/?format=api", "name": "Laurent Pinchart", "email": "laurent.pinchart@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/10232/mbox/", "series": [ { "id": 1411, "url": "https://patchwork.libcamera.org/api/series/1411/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1411", "date": "2020-10-23T22:00:20", "name": "[libcamera-devel] libcamera: controls: Disable ControlValue<T> construction from unsupported T", "version": 1, "mbox": "https://patchwork.libcamera.org/series/1411/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/10232/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/10232/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 E5D9ABDB13\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 23 Oct 2020 22:01:14 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 746DA61B8D;\n\tSat, 24 Oct 2020 00:01:14 +0200 (CEST)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 3C9BC615D2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 24 Oct 2020 00:01:11 +0200 (CEST)", "from pendragon.lan (62-78-145-57.bb.dnainternet.fi [62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id C6E5B9BF;\n\tSat, 24 Oct 2020 00:01:10 +0200 (CEST)" ], "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"qmui/rOy\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1603490471;\n\tbh=6sNVQxqVMn98JdO0K1EO6MlrMIdrAWhOBNeKfwOHVII=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=qmui/rOyTaRmAByxffTO4xdBfUQZJfw+2jiTUxmqWW7RXgeIk4Tvg/fDnTGlAVkU7\n\t/2FJAK6c4GJm5g5jzqVh+l/tlzbmv9yiFoz24thAVDwTeMLWQ2cWYBZkSTIfeYl92a\n\tuL82mVyd0EZ1YzHCGP24cbYTqxXc/HfUyWFfffuQ=", "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Sat, 24 Oct 2020 01:00:20 +0300", "Message-Id": "<20201023220020.22536-1-laurent.pinchart@ideasonboard.com>", "X-Mailer": "git-send-email 2.27.0", "MIME-Version": "1.0", "Subject": "[libcamera-devel] [PATCH] 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": "The 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\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 3d7f4b0dc1a7..3b7f3347761e 100644\n--- a/include/libcamera/controls.h\n+++ b/include/libcamera/controls.h\n@@ -97,6 +97,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" ] }