Bug#908904: /usr/include/mgl2/config.h: error: unable to find numeric literal operator ‘operator?=""=?UTF-8?Q?i’

D Haley mycae at gmx.com
Fri Oct 12 16:19:13 BST 2018


Hi Marius,

I've raised this with upstream, and they believe have a fix in their
repository (r1587 and up). If you have a chance, can you check their
patch against the Debian package?

Otherwise I will check this in the coming weeks.

Thanks!

On Sat, 15 Sep 2018 20:04:33 +0200 Marius Mikucionis
<mmikucionis at gmail.com> wrote:
> Package: libmgl-dev
> Version: 2.4.2.1-2
> Severity: normal
> File: /usr/include/mgl2/config.h
> 
> Dear Maintainer,
> 
> The package is unusable in the context "g++ -std=c++11" or newer (c++14, c++17).
> The same issue is in bug report 800460, but it is archived.
> Here is a sample program:
> 
> #include <mgl2/mgl.h>
> int main() {
> 	mglGraph gr;
> 	gr.FPlot("sin(pi*x)");
> 	gr.WriteFrame("mgl_test.svg");
> }
> 
> The compiler responds as follows:
> 
> In file included from /usr/include/mgl2/abstract.h:23,
>                  from /usr/include/mgl2/data_cf.h:23,
>                  from /usr/include/mgl2/data.h:23,
>                  from /usr/include/mgl2/mgl_cf.h:24,
>                  from /usr/include/mgl2/mgl.h:23,
>                  from tests.cpp:16:
> /usr/include/mgl2/define.h:304:19: error: unable to find numeric literal operator ‘operator""i’
>  const mdual mgl_I=_Complex_I;
>                    ^~~~~~~~~~
> /usr/include/mgl2/define.h:304:19: note: add ‘using namespace std::complex_literals’ (from <complex>) to enable the C++14 user-defined literal suffixes
> 
> 
> I believe this is due to syntax clash between C99 and C++11
> (C++14 introduces complex literals to support expressions like "1i").
> libmgl-dev is trying to support both but C complex numbers do not make sense in C++ context.
> I cannot see any userspace workaround other than downgrade my code to pre-C++11.
> 
> I propose to disable C complex numbers starting with C++11:
> 
> --- /usr/include/mgl2/config.h	2018-09-15 19:57:46.661432502 +0200
> +++ /usr/include/mgl2/config.h.orig	2018-09-15 19:25:14.843095200 +0200
> @@ -28,11 +28,7 @@
>  #define MGL_HAVE_PTHREAD	1
>  #define MGL_HAVE_PTHR_WIDGET	1
>  #define MGL_HAVE_ATTRIBUTE	1
> -#if defined(__cplusplus) && __cplusplus < 201103
>  #define MGL_HAVE_C99_COMPLEX	1
> -#else
> -#define MGL_HAVE_C99_COMPLEX	0
> -#endif
>  #endif
>  
>  #define MGL_SIZEOF_LONG	8
> 
> 
> Marius
> 
> -- System Information:
> Debian Release: buster/sid
>   APT prefers testing



More information about the debian-science-maintainers mailing list