Re: g++4.9.2 fails to compile standard C++11 code

2015-03-14 Thread JonY
On 3/14/2015 04:58, Christian Franke wrote:
 
 Yes. The attached patch for cmath include file would fix this.
 
 Christian
 

Hi,

I think newlib should be updated instead. Patching a libstdc++ header is
something I'd want to avoid.





signature.asc
Description: OpenPGP digital signature


Re: g++4.9.2 fails to compile standard C++11 code

2015-03-13 Thread Christian Franke

Corinna Vinschen wrote:

On Mar 13 09:13, Csaba Raduly wrote:

Hi

On Thu, Mar 12, 2015 at 10:55 AM, Duncan Roe  wrote:

On Wed, Mar 11, 2015 at 06:55:16PM -0400, Vlad Gheorghiu wrote:

The following code fails to compile under latest cygwin, Windows 7,
g++4.9.2. Compiled with g++ -std=c++11 test.cpp. The compiler
complains that std::log2 is not a member of std.

 #include cmath
 #include iostream

 int main()
 {
 auto x = std::log2(10);
 std::cout  x  std::endl;
 }


Verbatim error:

 g++ -std=c++11 test.cpp
 test.cpp: In function 'int main()':
 test.cpp:5:11: error: 'log2' is not a member of 'std'
   auto x = std::log2(10);
^
 test.cpp:5:11: note: suggested alternative:
 In file included from
/usr/lib/gcc/i686-pc-cygwin/4.9.2/include/c++/cmath:44:0,
  from test.cpp:1:
 /usr/include/math.h:305:15: note:   ???log2???
  extern double log2 _PARAMS((double));


FWIW, this program works fine under Linux / gcc4.8.2:

ISTR a discussion about some C++11 features being configured away due
to Cygwin's lack of some C library functions (to_string not a member
of std): https://sourceware.org/ml/cygwin/2015-01/msg00245.html

Your issue may be related (I'm guessing here because I don't have
Cygwin at hand right now).

I guess the same.  The problem is probably related to the fact that
newlib is still missing most of the long double functions (cosl, sinl,
etc).  The libstdc++ configury seems to activate the related std methods
only if *all* related C library functions for double, float and long
double (e.g. cos, cosf, cosl) are implemented by the platform.


Yes. The attached patch for cmath include file would fix this.

Christian

--- /usr/lib/gcc/i686-pc-cygwin/4.9.2/include/c++/cmath.orig	2015-02-24 02:02:20.0 +0100
+++ /usr/lib/gcc/i686-pc-cygwin/4.9.2/include/c++/cmath	2015-03-13 09:39:58.098696700 +0100
@@ -922,7 +922,7 @@ _GLIBCXX_END_NAMESPACE_VERSION
 
 #if __cplusplus = 201103L
 
-#ifdef _GLIBCXX_USE_C99_MATH_TR1
+#if defined(_GLIBCXX_USE_C99_MATH_TR1) || defined(__CYGWIN__)
 
 #undef acosh
 #undef acoshf
@@ -1041,87 +1041,66 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   // functions
   using ::acosh;
   using ::acoshf;
-  using ::acoshl;
 
   using ::asinh;
   using ::asinhf;
-  using ::asinhl;
 
   using ::atanh;
   using ::atanhf;
-  using ::atanhl;
 
   using ::cbrt;
   using ::cbrtf;
-  using ::cbrtl;
 
   using ::copysign;
   using ::copysignf;
-  using ::copysignl;
 
   using ::erf;
   using ::erff;
-  using ::erfl;
 
   using ::erfc;
   using ::erfcf;
-  using ::erfcl;
 
   using ::exp2;
   using ::exp2f;
-  using ::exp2l;
 
   using ::expm1;
   using ::expm1f;
-  using ::expm1l;
 
   using ::fdim;
   using ::fdimf;
-  using ::fdiml;
 
   using ::fma;
   using ::fmaf;
-  using ::fmal;
 
   using ::fmax;
   using ::fmaxf;
-  using ::fmaxl;
 
   using ::fmin;
   using ::fminf;
-  using ::fminl;
 
   using ::hypot;
   using ::hypotf;
-  using ::hypotl;
 
   using ::ilogb;
   using ::ilogbf;
-  using ::ilogbl;
 
   using ::lgamma;
   using ::lgammaf;
-  using ::lgammal;
 
   using ::llrint;
   using ::llrintf;
-  using ::llrintl;
 
   using ::llround;
   using ::llroundf;
-  using ::llroundl;
 
   using ::log1p;
   using ::log1pf;
-  using ::log1pl;
 
   using ::log2;
   using ::log2f;
-  using ::log2l;
 
   using ::logb;
   using ::logbf;
-  using ::logbl;
 
   using ::lrint;
   using ::lrintf;
@@ -1129,31 +1108,21 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
   using ::lround;
   using ::lroundf;
-  using ::lroundl;
 
   using ::nan;
   using ::nanf;
-  using ::nanl;
 
   using ::nearbyint;
   using ::nearbyintf;
-  using ::nearbyintl;
 
   using ::nextafter;
   using ::nextafterf;
-  using ::nextafterl;
-
-  using ::nexttoward;
-  using ::nexttowardf;
-  using ::nexttowardl;
 
   using ::remainder;
   using ::remainderf;
-  using ::remainderl;
 
   using ::remquo;
   using ::remquof;
-  using ::remquol;
 
   using ::rint;
   using ::rintf;
@@ -1161,23 +1130,56 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
   using ::round;
   using ::roundf;
-  using ::roundl;
 
   using ::scalbln;
   using ::scalblnf;
-  using ::scalblnl;
 
   using ::scalbn;
   using ::scalbnf;
-  using ::scalbnl;
 
   using ::tgamma;
   using ::tgammaf;
-  using ::tgammal;
 
   using ::trunc;
   using ::truncf;
+
+#ifndef __CYGWIN__
+  using ::acoshl;
+  using ::asinhl;
+  using ::atanhl;
+  using ::cbrtl;
+  using ::copysignl;
+  using ::erfl;
+  using ::erfcl;
+  using ::exp2l;
+  using ::expm1l;
+  using ::fdiml;
+  using ::fmal;
+  using ::fmaxl;
+  using ::fminl;
+  using ::hypotl;
+  using ::ilogbl;
+  using ::lgammal;
+  using ::llrintl;
+  using ::llroundl;
+  using ::log1pl;
+  using ::log2l;
+  using ::logbl;
+  using ::lroundl;
+  using ::nanl;
+  using ::nearbyintl;
+  using ::nextafterl;
+  using ::nexttoward;
+  using ::nexttowardf;
+  using ::nexttowardl;
+  using ::remainderl;
+  using ::remquol;
+  using ::roundl;
+  

Re: g++4.9.2 fails to compile standard C++11 code

2015-03-13 Thread Csaba Raduly
Hi

On Thu, Mar 12, 2015 at 10:55 AM, Duncan Roe  wrote:
 On Wed, Mar 11, 2015 at 06:55:16PM -0400, Vlad Gheorghiu wrote:
 The following code fails to compile under latest cygwin, Windows 7,
 g++4.9.2. Compiled with g++ -std=c++11 test.cpp. The compiler
 complains that std::log2 is not a member of std.

 #include cmath
 #include iostream

 int main()
 {
 auto x = std::log2(10);
 std::cout  x  std::endl;
 }


 Verbatim error:

 g++ -std=c++11 test.cpp
 test.cpp: In function 'int main()':
 test.cpp:5:11: error: 'log2' is not a member of 'std'
   auto x = std::log2(10);
^
 test.cpp:5:11: note: suggested alternative:
 In file included from
 /usr/lib/gcc/i686-pc-cygwin/4.9.2/include/c++/cmath:44:0,
  from test.cpp:1:
 /usr/include/math.h:305:15: note:   ???log2???
  extern double log2 _PARAMS((double));

 FWIW, this program works fine under Linux / gcc4.8.2:

ISTR a discussion about some C++11 features being configured away due
to Cygwin's lack of some C library functions (to_string not a member
of std): https://sourceware.org/ml/cygwin/2015-01/msg00245.html

Your issue may be related (I'm guessing here because I don't have
Cygwin at hand right now).

Csaba
-- 
GCS a+ e++ d- C++ ULS$ L+$ !E- W++ P+++$ w++$ tv+ b++ DI D++ 5++
The Tao of math: The numbers you can count are not the real numbers.
Life is complex, with real and imaginary parts.
Ok, it boots. Which means it must be bug-free and perfect.  -- Linus Torvalds
People disagree with me. I just ignore them. -- Linus Torvalds

--
Problem reports:   http://cygwin.com/problems.html
FAQ:   http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple



Re: g++4.9.2 fails to compile standard C++11 code

2015-03-13 Thread Corinna Vinschen
On Mar 13 09:13, Csaba Raduly wrote:
 Hi
 
 On Thu, Mar 12, 2015 at 10:55 AM, Duncan Roe  wrote:
  On Wed, Mar 11, 2015 at 06:55:16PM -0400, Vlad Gheorghiu wrote:
  The following code fails to compile under latest cygwin, Windows 7,
  g++4.9.2. Compiled with g++ -std=c++11 test.cpp. The compiler
  complains that std::log2 is not a member of std.
 
  #include cmath
  #include iostream
 
  int main()
  {
  auto x = std::log2(10);
  std::cout  x  std::endl;
  }
 
 
  Verbatim error:
 
  g++ -std=c++11 test.cpp
  test.cpp: In function 'int main()':
  test.cpp:5:11: error: 'log2' is not a member of 'std'
auto x = std::log2(10);
 ^
  test.cpp:5:11: note: suggested alternative:
  In file included from
  /usr/lib/gcc/i686-pc-cygwin/4.9.2/include/c++/cmath:44:0,
   from test.cpp:1:
  /usr/include/math.h:305:15: note:   ???log2???
   extern double log2 _PARAMS((double));
 
  FWIW, this program works fine under Linux / gcc4.8.2:
 
 ISTR a discussion about some C++11 features being configured away due
 to Cygwin's lack of some C library functions (to_string not a member
 of std): https://sourceware.org/ml/cygwin/2015-01/msg00245.html
 
 Your issue may be related (I'm guessing here because I don't have
 Cygwin at hand right now).

I guess the same.  The problem is probably related to the fact that
newlib is still missing most of the long double functions (cosl, sinl,
etc).  The libstdc++ configury seems to activate the related std methods
only if *all* related C library functions for double, float and long
double (e.g. cos, cosf, cosl) are implemented by the platform.


Corinna

-- 
Corinna Vinschen  Please, send mails regarding Cygwin to
Cygwin Maintainer cygwin AT cygwin DOT com
Red Hat


pgpoFxXbx2uDd.pgp
Description: PGP signature


Re: g++4.9.2 fails to compile standard C++11 code

2015-03-12 Thread Duncan Roe
On Wed, Mar 11, 2015 at 06:55:16PM -0400, Vlad Gheorghiu wrote:
 The following code fails to compile under latest cygwin, Windows 7,
 g++4.9.2. Compiled with g++ -std=c++11 test.cpp. The compiler
 complains that std::log2 is not a member of std.

 #include cmath
 #include iostream

 int main()
 {
 auto x = std::log2(10);
 std::cout  x  std::endl;
 }


 Verbatim error:

 g++ -std=c++11 test.cpp
 test.cpp: In function ???int main()???:
 test.cpp:5:11: error: ???log2??? is not a member of ???std???
   auto x = std::log2(10);
^
 test.cpp:5:11: note: suggested alternative:
 In file included from
 /usr/lib/gcc/i686-pc-cygwin/4.9.2/include/c++/cmath:44:0,
  from test.cpp:1:
 /usr/include/math.h:305:15: note:   ???log2???
  extern double log2 _PARAMS((double));

FWIW, this program works fine under Linux / gcc4.8.2:

20:45:23$ uname -a
Linux dimstar 3.19.0-k8 #1 SMP Mon Mar 2 21:58:02 EST 2015 i686 AMD Athlon(tm) 
64 X2 Dual Core Processor 6000+ AuthenticAMD GNU/Linux
20:45:44$ g++ --version
g++ (GCC) 4.8.2
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

20:47:26$ g++ -std=c++11 cygwin.cpp -o cygwin
20:50:25$ ./cygwin
3.32193
20:50:36$ cat cygwin.cpp
#include cmath
#include iostream
int main()
{
  auto x = std::log2(10);
  std::cout  x  std::endl;
}  /* int main() */

Cheers ... Duncan.

--
Problem reports:   http://cygwin.com/problems.html
FAQ:   http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple



Re: g++4.9.2 fails to compile standard C++11 code

2015-03-12 Thread Roger Wells

On 03/11/2015 06:55 PM, Vlad Gheorghiu wrote:

The following code fails to compile under latest cygwin, Windows 7,
g++4.9.2. Compiled with g++ -std=c++11 test.cpp. The compiler
complains that std::log2 is not a member of std.

 #include cmath
 #include iostream

 int main()
 {
 auto x = std::log2(10);
 std::cout  x  std::endl;
 }


Verbatim error:

 g++ -std=c++11 test.cpp
 test.cpp: In function ‘int main()’:
 test.cpp:5:11: error: ‘log2’ is not a member of ‘std’
   auto x = std::log2(10);
^
 test.cpp:5:11: note: suggested alternative:
 In file included from
/usr/lib/gcc/i686-pc-cygwin/4.9.2/include/c++/cmath:44:0,
  from test.cpp:1:
 /usr/include/math.h:305:15: note:   ‘log2’
  extern double log2 _PARAMS((double));


FWIW
I get the same error on cygwin64 gcc 4.9.2
but
it is fine on:
Linux, gcc 4.9.2 (Fedora 21)
MinGW, 32 bit, gcc 4.7.0 (Windows 7)
MinGW, 64 bit, gcc 4.9.0 (Windows 7)

HTH


--
Roger Wells, P.E.
leidos
221 Third St
Newport, RI 02840
401-847-4210 (voice)
401-849-1585 (fax)
roger.k.we...@leidos.com


--
Problem reports:   http://cygwin.com/problems.html
FAQ:   http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple



g++4.9.2 fails to compile standard C++11 code

2015-03-11 Thread Vlad Gheorghiu
The following code fails to compile under latest cygwin, Windows 7,
g++4.9.2. Compiled with g++ -std=c++11 test.cpp. The compiler
complains that std::log2 is not a member of std.

#include cmath
#include iostream

int main()
{
auto x = std::log2(10);
std::cout  x  std::endl;
}


Verbatim error:

g++ -std=c++11 test.cpp
test.cpp: In function ‘int main()’:
test.cpp:5:11: error: ‘log2’ is not a member of ‘std’
  auto x = std::log2(10);
   ^
test.cpp:5:11: note: suggested alternative:
In file included from
/usr/lib/gcc/i686-pc-cygwin/4.9.2/include/c++/cmath:44:0,
 from test.cpp:1:
/usr/include/math.h:305:15: note:   ‘log2’
 extern double log2 _PARAMS((double));

-- 
Dr. Vlad Gheorghiu
Institute for Quantum Computing
Waterloo, Ontario
Canada
http://community.iqc.uwaterloo.ca/vgheorgh/

--
Problem reports:   http://cygwin.com/problems.html
FAQ:   http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple