On 8/20/19 3:41 PM, Andreas Tille wrote: > Hi Olivier, > > I'm just forwarding this to Debian Mentors list to get a wider audience. > I'd prefer a fix over simply removing the test ...
commenting in text_line_reader.h: // operator const std::string& () const { return line_string() ; } do the job and test pass but I would prefer a c++ friend to acknowledge this.... It works but I do not if there are side effects.... Olivier > > Thanks for your analysis anyway > > Andreas. > > On Tue, Aug 20, 2019 at 03:36:48PM +0200, Olivier Sallou wrote: >> On 8/20/19 1:24 PM, Andreas Tille wrote: >>> Control: tags -1 help >>> >>> Hi, >>> >>> any hint how to deal with >> >> this is a test file. In test, there is explicit conversion to string: >> >> line = reader.line_string() ; //first line - with explicit method to get >> the string >> >> which works fine as expected >> >> In gcc 9 bug, it is implicit conversion that fails. Seems due some c++ >> 11 updates on operators, but I am not an expert on this kind of stuff. >> >> As this is only a test, and there is a way to get the result as a string >> (as first test above test with explicit method), I wonder if we could >> not simply patch to remove those lines: >> >> >> line = reader ; //second line - with implicit conversion to >> std::string >> ASSERT( line == "second line" ) ; >> >> Further test may also complain (using implicit too): >> >> istream &is2 ( reader ) ; // fourth line - with implicit >> conversion to std::istream >> >> >> However, as it is a library, implicit conversion may fail on other tools >> linking with this lib.... Best of course would be to get a fix for this >> assignement operator >> >> Olivier >> >>> >>> ... >>> g++ -DHAVE_CONFIG_H -I. -I.. -I../src -Wdate-time -D_FORTIFY_SOURCE=2 -g >>> -O2 -fdebug-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat >>> -Werror=format-security -Wall -Wextra -Wformat-nonliteral -Wformat-security >>> -Wswitch-default -Wswitch-enum -Wunused-parameter -Wfloat-equal -Werror >>> -DDEBUG -g -O1 -DDEBUG -g -O1 -c -o test_text_reader.o test_text_reader.cpp >>> test_text_reader.cpp: In function 'int main()': >>> test_text_reader.cpp:48:9: error: ambiguous overload for 'operator=' >>> (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} >>> and 'TextLineReader') >>> 48 | line = reader ; //second line - with implicit conversion to >>> std::string >>> | ^~~~~~ >>> In file included from /usr/include/c++/9/string:55, >>> from /usr/include/c++/9/bits/locale_classes.h:40, >>> from /usr/include/c++/9/bits/ios_base.h:41, >>> from /usr/include/c++/9/ios:42, >>> from /usr/include/c++/9/ostream:38, >>> from /usr/include/c++/9/iostream:39, >>> from test_text_reader.cpp:19: >>> /usr/include/c++/9/bits/basic_string.h:665:7: note: candidate: >>> 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& >>> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(const >>> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char; >>> _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' >>> 665 | operator=(const basic_string& __str) >>> | ^~~~~~~~ >>> /usr/include/c++/9/bits/basic_string.h:732:7: note: candidate: >>> 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& >>> std::__cxx11::basic_string<_CharT, _Traits, >>> _Alloc>::operator=(std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&&) >>> [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = >>> std::allocator<char>]' >>> 732 | operator=(basic_string&& __str) >>> | ^~~~~~~~ >>> make[3]: *** [Makefile:781: test_text_reader.o] Error 1 >>> >>> >>> Kind regards >>> >>> Andreas. >>> >>> >> -- >> Olivier Sallou >> Univ Rennes, Inria, CNRS, IRISA >> Irisa, Campus de Beaulieu >> F-35042 RENNES - FRANCE >> Tel: 02.99.84.71.95 >> >> gpg key id: 4096R/326D8438 (keyring.debian.org) >> Key fingerprint = 5FB4 6F83 D3B9 5204 6335 D26D 78DC 68DB 326D 8438 >> >> >> -- Olivier Sallou Univ Rennes, Inria, CNRS, IRISA Irisa, Campus de Beaulieu F-35042 RENNES - FRANCE Tel: 02.99.84.71.95 gpg key id: 4096R/326D8438 (keyring.debian.org) Key fingerprint = 5FB4 6F83 D3B9 5204 6335 D26D 78DC 68DB 326D 8438