From: K. F. <kfr...@gm...> - 2011-03-26 12:32:50
|
Hi Greg! On Sat, Mar 26, 2011 at 7:33 AM, Greg Chicares <gch...@sb...> wrote: > On 2011-03-26 02:17Z, K. Frank wrote: >> >> On Tue, Mar 22, 2011 at 9:53 AM, Greg Chicares <gch...@sb...> wrote: >>> >>> std::string s("uvw"); >>> std::string s3b = dynamic_cast<std::stringstream&>(std::stringstream() << s).str(); >>> std::cout << "expecting uvw: " << s3b << std::endl; >>> >>> That succeeds with Comeau (but prints the pointer address), but fails >>> with MinGW gcc-3.4.5: >>> no match for 'operator<<' in 'stringstream(std::operator|( _S_out, _S_in)) << s' >>> and 'stringstream(std::operator|( _S_out, _S_in))'... >> ... >> I tried it with the Comeau online compiler (It doesn't actually >> build the final executable, so you can't run it.), and it fails to >> compile with an error analogous to that reported by mingw: >> >> "ComeauTest.c", line 27: error: no operator "<<" matches these operands >> operand types are: std::stringstream << std::string >> std::string s7 = >> dynamic_cast<std::stringstream&>(std::stringstream() << s).str(); >> >> (The online compiler announces itself as "Comeau C/C++ 4.3.10.1".) >> >> That is, I'm failing to reproduce with the online compiler your >> Comeau result. Any thoughts? > > Abbreviated testcase: > ... > It compiles and links here: > /home/Arktos/tmp[0]$export COMO_MIN_INCLUDE=/opt/lmi/como/mingw_for_como/include > /home/Arktos/tmp[0]$PATH=/opt/lmi/como/bin:/opt/lmi/como/mingw_for_como/bin:/usr > /bin:/bin:/usr/sbin:/sbin:/cygdrive/c/WINDOWS/system32:/cygdrive/c/WINDOWS:/cygd > rive/c/WINDOWS/System32/Wbem > /home/Arktos/tmp[0]$como stringstream_cast_como.cpp > Comeau C/C++ 4.3.10.1 (May 7 2008 09:22:38) for MS_WINDOWS_x86_Beta1 > Copyright 1988-2008 Comeau Computing. All rights reserved. > MODE:non-strict warnings MinGW C++ noC++0x_extensions > and prints: > /home/Arktos/tmp[0]$./aout > expecting uvw: uvw > > However, pasting it here: > http://www.comeaucomputing.com/tryitout/ > I cannot find any combination of options that prevents the > error we expect. The compilers aren't quite identical: > Comeau C/C++ 4.3.10.1 (May 7 2008 09:22:38) [my local copy] > Comeau C/C++ 4.3.10.1 (Oct 6 2008 11:28:09) [online] > but it's hard to believe that different builds of the same version > of an EDG compiler would change this fundamental behavior. > > Wait...even with "Compile in relaxed mode", the online compiler > gives an error; but if I add '--a' for strict mode locally, then > I do get the expected error: > /home/Arktos/tmp[0]$como --no_microsoft_bugs --a stringstream_cast_como.cpp > Comeau C/C++ 4.3.10.1 (May 7 2008 09:22:38) for MS_WINDOWS_x86_Beta1 > Copyright 1988-2008 Comeau Computing. All rights reserved. > MODE:strict warnings [MinGW] C++ noC++0x_extensions > > "stringstream_cast_como.cpp", line 10: error: no operator "<<" matches these > operands > operand types are: std::stringstream << std::string > ((std::stringstream()) << s).str(); > ^ > I don't normally use strict mode because it's incompatible with > <windows.h>, but it's appropriate for this testcase. Well, that's it bit odd.. But in any event, it sounds like Comeau recognizes the issue as you determined using strict mode. There is apparently some minor difference in Comea's strict / relaxed processing between your copy and the online version. No big deal, but thanks for checking. Best. K. Frank |