delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2005/09/26/07:39:55

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
From: "Dave Korn" <dave DOT korn AT artimi DOT com>
To: <cygwin AT cygwin DOT com>
Subject: RE: Strange behaviour with g++ 3.4.4-1
Date: Mon, 26 Sep 2005 12:39:40 +0100
MIME-Version: 1.0
In-Reply-To: <Pine.OSF.4.21.0509232252190.96-100000@ax0rm1.roma1.infn.it>
Message-ID: <SERRANOvM9KfYDovvQ000000255@SERRANO.CAM.ARTIMI.COM>

----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 AT mace /test/cplus> g++ test.fixed.cpp -o test
dk AT 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 AT 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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019