O
Owen Brydon
Hello,
Can anyone confirm if the following is a bug in MSVC++7.1, or an error
in the code?. This compiles fine under g++ and MSVC++7.0
#include <string>
using std::string;
class hello
{
public:
hello() {}
~hello(){}
void fn(string::size_type Index=string::npos) {}
};
int main()
{
hello a;
return 0;
}
If I take fn() out of the class and put it at global scope, it
compiles fine. Otherwise, I get the following errors:
main.cpp(10) : error C2653:
'basic_string<char,std::char_traits<char>,std::allocator<char> >' : is
not a class or namespace name
main.cpp(10) : error C2065: 'npos' : undeclared identifier
Like I say, this was fine under the previous version of Visual C++, so
have I got a subtle error, or have MS broken their compiler?
Owen Brydon
Can anyone confirm if the following is a bug in MSVC++7.1, or an error
in the code?. This compiles fine under g++ and MSVC++7.0
#include <string>
using std::string;
class hello
{
public:
hello() {}
~hello(){}
void fn(string::size_type Index=string::npos) {}
};
int main()
{
hello a;
return 0;
}
If I take fn() out of the class and put it at global scope, it
compiles fine. Otherwise, I get the following errors:
main.cpp(10) : error C2653:
'basic_string<char,std::char_traits<char>,std::allocator<char> >' : is
not a class or namespace name
main.cpp(10) : error C2065: 'npos' : undeclared identifier
Like I say, this was fine under the previous version of Visual C++, so
have I got a subtle error, or have MS broken their compiler?
Owen Brydon