This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: Strange behaviour with g++ 3.4.4-1


----Original Message----
>From: Angelo Graziosi
>Sent: 23 September 2005 22:01

> Rebuilding, with GCC 3.4.4-1, a few my Windows applications
> (those that use -mwindows), I have found a compiler error that
> was absent in the build with GCC 3.3.3-3.
> 
> I have created the simplest test case that reproduces the 'phenomenon'
>
> /usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/bits/sstream.tcc:
> In member function `virtual typename
> std::basic_stringbuf<_CharT, _Traits, _Alloc>::int_type
> std::basic_stringbuf<_CharT, _Traits, _Alloc>::overflow(typename
> _Traits::int_type)':
> /usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/bits/sstream.tcc:102:
> error: expected unqualified-id before '(' token
> /usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/bits/sstream.tcc:104:
> error: expected unqualified-id before '(' token

  Those lines are:

   102            const __size_type __opt_len = std::max(__size_type(2 *
__capacity),
   103                                                   __size_type(512));
   104            const __size_type __len = std::min(__opt_len, __max_size);

  Something #def'd min and max, making the preprocessed source look like
this:

   const __size_type __opt_len = std::((__size_type(2 *
__capacity))>(__size_type(512))?(__size_type(2 *
__capacity)):(__size_type(512)));

   const __size_type __len =
std::((__opt_len)<(__max_size)?(__opt_len):(__max_size));

It came shortly after here:

# 97 "/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/windef.h"
3

You can fix it like this:

dk@mace /test/cplus> g++ test.fixed.cpp -o test
dk@mace /test/cplus> diff -pu test.cpp test.fixed.cpp
--- test.cpp    2005-09-26 10:52:37.405042000 +0100
+++ test.fixed.cpp      2005-09-26 10:52:26.555119000 +0100
@@ -1,6 +1,8 @@

 #include <iostream>
 #include <windows.h>
+#undef max
+#undef min
 #include <complex>


dk@mace /test/cplus>

    cheers,
      DaveK
-- 
Can't think of a witty .sigline today....


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]