Versions: This bug has existed for a long time, easily over a year and up to the current beta 1646. Environment: VS2003
Basically create declaration for a member function in a namespace erroneously adds the class specification to the header. This code will compile in VS2003 but will not compile in other more compliant compilers (GCC,maybe VS2005/8).
Replication:
//in header namespace Foo { class Bar { }; }
//in source namespace Foo { Bar::Bar() { } }
Now create declaration for Bar::Bar() and you get:
namespace Foo { class Bar {
Bar::Bar(); }; }
When it should be: namespace Foo { class Bar { Bar(); }; }
The extra line break isn't that much of issue, but clearly Bar::Bar() is wrong. When you remove the namespace all together it works properly. I'm guess when iterating over the list of ns/class specifiers for the function it isn't removing all of them (its leaving the last still attached).