This code is accepted by MSVC9.0. My question is whether it is legal according to the standard (the old and/or the new one). A quote would be very much welcome, too.
class X
{
void X::f();
};
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
No, this is not valid. Here,
X::fis a qualified name; you are attempting to use it as a declarator-id. C++03 8.3[dcl.meaning]/1 lists the circumstances under which a declarator-id may be qualified:Because
X::ffalls into none of these four categories, it is incorrect.The rule that requires the definition of a member function outside of the class definition to be qualified can be found at C++03 9.3[class.mfct]/5: