Boost logo

Boost :

From: Doug Gregor (gregod_at_[hidden])
Date: 2001-03-09 13:58:12

On Friday 09 March 2001 06:01, Dale Peakall wrote:
> The copy constructor from any_function-2.16 causes VC6 SP4 to
> mis-parse the rest of the source file, e.g.
> It appears that the compiler eats the next token. Add a random token after
> the copy constructor and the whole thing works just fine! i.e.
> any2ints a2(a1); wibble // this works!

In my testcases I'd adopted the trivial workaround of adding an extra ';'
after any explicit copy construction . Unfortunately this will be incorrect
at global scope, and the behavior in a constructor is even more shocking:

struct foo {
  any_function<void> f;
  foo(const any_function<void>& f_in) : f(f_in) { int int a; }

Here, MSVC correctly handles the '{' after the copy construction, but eats
the first 'int' token instead.

However, implicit copy construction works properly as far as I can tell, so
this error is not crippling - just annoying. The copy assignment operator
works properly, so:

any2ints a2(a1);

Can be rewritten as:
any2ints a2;
a2 = a1;

I have tried (repeatedly) to find a workaround for MSVC, but to no avail. If
anyone has seen a workaround for this problem I would be very interested.

Unfortunately it seems that my only recourse is to document the problem with
its workaround and hope that someday MS fixes it (the problem still exists in


Boost list run by bdawes at, gregod at, cpdaniel at, john at