[Bug c++/84667] New: unreasonable refusal to use assignment operator method
estellnb at elstel dot org
gcc-bugzilla@gcc.gnu.org
Fri Mar 2 10:13:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84667
Bug ID: 84667
Summary: unreasonable refusal to use assignment operator method
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: estellnb at elstel dot org
Target Milestone: ---
Created attachment 43542
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=43542&action=edit
sample program that evokes the given error
g++ (Debian 6.3.0-18+deb9u1) 6.3.0 20170516:
At me g++ refuses to make use of the following operator
xstrbuf& operator = ( base_str_const s );
Instead it seems to convert an xstr_const into an xstr_mutable which is
generally forbidden and not enabled by my code.
Things work well however if I use the standard constructor instead of an
assignment:
inline xstrbuf( base_str_const s ) : base_str(
const_cast<char_type*>(s.chars), s.length ) { bufParams = xstrbuf_constBuf; };
It is important to get the "bufParams = xstrbuf_constBuf; " executed otherwise
the code will fail. You can test for it yourself by executing ./runit.
Any feedback would be very appreciated!
More information about the Gcc-bugs
mailing list