Bug#908904: /usr/include/mgl2/config.h: error: unable to find numeric literal operator ‘operator""i’

2018-10-17 Thread Marius Mikucionis
Package: libmgl-dev
Version: 2.4.2.1-2
Followup-For: Bug #908904

Dear D Haley,

Thanks for your personal message, I did not receive the bug update indeed.
I looked at r1587 and it seems to disable the C99 complex numbers by default.
So I compiled the latest (r1589) and my tiny example worked with the default 
build.
This is good for my purposes, I just hope it'll continue to work for C 
developers too.

Thank you for taking care of this.

Marius



Bug#908904: /usr/include/mgl2/config.h: error: unable to find numeric literal operator ‘operator""i’

2018-10-12 Thread D Haley
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
 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 
> 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 ) 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.h2018-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



Bug#908904: /usr/include/mgl2/config.h: error: unable to find numeric literal operator ‘operator""i’

2018-09-15 Thread Marius Mikucionis
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 
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 ) 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_LONG8


Marius

-- System Information:
Debian Release: buster/sid
  APT prefers testing
  APT policy: (900, 'testing'), (500, 'stable'), (500, 'oldstable'), (50, 
'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.18.0-1-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages libmgl-dev depends on:
ii  libgl1-mesa-dev [libgl-dev]  18.1.7-1
ii  libgsl-dev   2.5+dfsg-5
ii  libmgl-fltk7.5.0 2.4.2.1-2
ii  libmgl-glut7.5.0 2.4.2.1-2
ii  libmgl-mpi7.5.0  2.4.2.1-2
ii  libmgl-qt5-7.5.0 2.4.2.1-2
ii  libmgl-wnd7.5.0  2.4.2.1-2
ii  libmgl-wx7.5.0   2.4.2.1-2
ii  libmgl7.5.0  2.4.2.1-2
ii  libpng-dev   1.6.34-2

libmgl-dev recommends no packages.

libmgl-dev suggests no packages.

-- no debconf information