I tested on two compilers, and was surprised to see both support the following definition without complaint:
class A {
A();
};
A::A::A() {}
^^^
Note that this also succeeds for methods, although it is flagged when the declaration is over-qualified.
Questions:
- Is this a valid C++ program?
- If so, what purpose does it serve - or is it merely a byproduct?
Updated Detail:
In case the original question was not clear or too short: I'm curious why redundant qualifications are permitted on the definition (emphasis also added above).
Clang an Apple's GCC 4.2 + LLVM were the compilers
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…