Ticket #13481: bug.cpp
| File bug.cpp, 376 bytes (added by , 5 years ago) |
|---|
| Line | |
|---|---|
| 1 | #include <iostream> |
| 2 | #include "boost/function.hpp" |
| 3 | |
| 4 | struct LogBuffer : public std::streambuf |
| 5 | { |
| 6 | char m_buf[222]; |
| 7 | }; |
| 8 | |
| 9 | struct Fun |
| 10 | { |
| 11 | void operator()() |
| 12 | { |
| 13 | if (i != 5) |
| 14 | { |
| 15 | abort(); |
| 16 | } |
| 17 | } |
| 18 | int i; |
| 19 | }; |
| 20 | |
| 21 | void x() |
| 22 | { |
| 23 | boost::function<void()> f; |
| 24 | f = Fun{5}; |
| 25 | LogBuffer c; |
| 26 | f(); |
| 27 | } |
| 28 | |
| 29 | int main(int argc, char *argv[]) |
| 30 | { |
| 31 | x(); |
| 32 | } |
| 33 |
