|
Boost : |
Subject: [boost] [spirit] hold_any missing assignment operator?
From: Robert Carlsen (rwcarlsen_at_[hidden])
Date: 2014-03-12 12:26:34
I ran into trouble when trying to do assignments between hold_any objects.
The problem seems to be fixed by adding a missing assignment operator to
basic_hold_any:
basic_hold_any& operator=(basic_hold_any const& x)
{
return assign(x);
}
Here is some code that demonstrates the problem:
int main(int argc, char* argv[]) {
boost::spirit::hold_any v1 = std::string("val1");
{
boost::spirit::hold_any v2 = std::string("val2");
v1 = v2;
}
return 0;
}
When executing that function, I get:
*** Error in `./foo': double free or corruption (fasttop):
0x0000000001a50040 ***
======= Backtrace: =========
/usr/lib/libc.so.6(+0x731ff)[0x7f4800a331ff]
/usr/lib/libc.so.6(+0x789ae)[0x7f4800a389ae]
/usr/lib/libc.so.6(+0x796b6)[0x7f4800a396b6]
/usr/lib/libstdc++.so.6(_ZNSsD1Ev+0x1f)[0x7f480133956f]
./foo[0x400e74]
./foo[0x400e10]
./foo[0x400cb7]
/usr/lib/libc.so.6(__libc_start_main+0xf5)[0x7f48009e1b05]
./foo[0x400b04]
======= Memory map: ========
00400000-00402000 r-xp 00000000 08:01 16813021
/home/robert/foo
00402000-00403000 rw-p 00001000 08:01 16813021
/home/robert/foo
01a50000-01a71000 rw-p 00000000 00:00 0
[heap]
7f48009c0000-7f4800b5e000 r-xp 00000000 08:01 6163783
/usr/lib/libc-2.19.so
7f4800b5e000-7f4800d5e000 ---p 0019e000 08:01 6163783
/usr/lib/libc-2.19.so
7f4800d5e000-7f4800d62000 r--p 0019e000 08:01 6163783
/usr/lib/libc-2.19.so
7f4800d62000-7f4800d64000 rw-p 001a2000 08:01 6163783
/usr/lib/libc-2.19.so
7f4800d64000-7f4800d68000 rw-p 00000000 00:00 0
7f4800d68000-7f4800d7d000 r-xp 00000000 08:01 6191352
/usr/lib/libgcc_s.so.1
7f4800d7d000-7f4800f7d000 ---p 00015000 08:01 6191352
/usr/lib/libgcc_s.so.1
7f4800f7d000-7f4800f7e000 rw-p 00015000 08:01 6191352
/usr/lib/libgcc_s.so.1
7f4800f7e000-7f480107e000 r-xp 00000000 08:01 6163651
/usr/lib/libm-2.19.so
7f480107e000-7f480127d000 ---p 00100000 08:01 6163651
/usr/lib/libm-2.19.so
7f480127d000-7f480127e000 r--p 000ff000 08:01 6163651
/usr/lib/libm-2.19.so
7f480127e000-7f480127f000 rw-p 00100000 08:01 6163651
/usr/lib/libm-2.19.so
7f480127f000-7f4801365000 r-xp 00000000 08:01 6191360
/usr/lib/libstdc++.so.6.0.19
7f4801365000-7f4801564000 ---p 000e6000 08:01 6191360
/usr/lib/libstdc++.so.6.0.19
7f4801564000-7f480156c000 r--p 000e5000 08:01 6191360
/usr/lib/libstdc++.so.6.0.19
7f480156c000-7f480156e000 rw-p 000ed000 08:01 6191360
/usr/lib/libstdc++.so.6.0.19
7f480156e000-7f4801583000 rw-p 00000000 00:00 0
7f4801583000-7f48015a3000 r-xp 00000000 08:01 6163762
/usr/lib/ld-2.19.so
7f4801778000-7f480177e000 rw-p 00000000 00:00 0
7f48017a1000-7f48017a3000 rw-p 00000000 00:00 0
7f48017a3000-7f48017a4000 r--p 00020000 08:01 6163762
/usr/lib/ld-2.19.so
7f48017a4000-7f48017a5000 rw-p 00021000 08:01 6163762
/usr/lib/ld-2.19.so
7f48017a5000-7f48017a6000 rw-p 00000000 00:00 0
7fff64671000-7fff64692000 rw-p 00000000 00:00 0
[stack]
7fff646a2000-7fff646a4000 r-xp 00000000 00:00 0
[vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0
[vsyscall]
Aborted (core dumped)
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk