| 210 | | return sign_inserter::call(sink, traits::test_zero(attr) |
| 211 | | , traits::test_negative(attr), force_sign) && |
| 212 | | int_inserter<Radix, CharEncoding, Tag>::call(sink |
| | 210 | // I have serialized the calls to better follow with the debugger what's going on. |
| | 211 | bool is_zero = traits::test_zero(attr); |
| | 212 | bool is_neg = traits::test_negative(attr); |
| | 213 | // Until here everything seems OK, *attr still has its value. |
| | 214 | // I can use, e.g., the attribute in a function call. |
| | 215 | Attribute attr_copy = dummy_function(attr); |
| | 216 | // bool r1 = sign_inserter::call(sink, is_zero |
| | 217 | // , is_neg, force_sign); |
| | 218 | // After the sign_inserter call, *attr becomes surprisingly zero. |
| | 219 | // Therefore, I inlined the important code parts to output the sign. |
| | 220 | if (is_neg) { |
| | 221 | *sink = '-'; |
| | 222 | // After putting the character into the sink, the *attr becomes zero. |
| | 223 | // Why??? This happens consistently unimportant whether it's |
| | 224 | // compiled using g++ or clang++ on Linux or Mac OS X. Is the sink |
| | 225 | // not correctly constructed and leaks memory? |
| | 226 | ++sink; |
| | 227 | } else if (force_sign) { |
| | 228 | if (is_zero) { |
| | 229 | *sink = ' '; |
| | 230 | } else { |
| | 231 | *sink = '+'; |
| | 232 | } |
| | 233 | ++sink; |
| | 234 | } |
| | 235 | bool r1 = true; |
| | 236 | bool r2 = int_inserter<Radix, CharEncoding, Tag>::call(sink |