From 55102734caedbe5ef42742ec8a5ae8b9d4e16538 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Wed, 12 Jun 2024 10:38:15 +0200 Subject: [PATCH] python: lol @ MSVC. --- src/python/magnum/gl.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/python/magnum/gl.cpp b/src/python/magnum/gl.cpp index a9e6ae0..f5283c3 100644 --- a/src/python/magnum/gl.cpp +++ b/src/python/magnum/gl.cpp @@ -375,10 +375,16 @@ void gl(py::module_& m) { }, "Whether there is any current context") .def_property_readonly_static("current", std::getenv("MCSS_GENERATING_OUTPUT") ? - [](const py::object&) { + /* Without the `+` converting the lambda to a func pointer, + MSVC dies with "error C2446: ':': no conversion from + 'magnum::gl::' to + 'magnum::gl::'". + All versions including 2022 are affected, works only + with the /permissive- flag. LOL. */ + +[](const py::object&) { return ContextHolder{nullptr}; - } : - [](const py::object&) { + } : + +[](const py::object&) { if(!GL::Context::hasCurrent()) { PyErr_SetString(PyExc_RuntimeError, "no current context"); throw py::error_already_set{};