In C++0x -n3290 Draft : they added in section :Destructors : 12.4/2nd point last line
**A destructor shall not be declared with a ref-qualifier.**
In c++03 Draft .... they didn't mention this point in destructors ?
my question is whether
*~S() ; //this declaration is allowed or not according to the Standard's
//**~S(); ***~S() ; etc...........
this type of declaration is allowed ? No where in the Draft he described about this ...Declaration?
In GCC 4.6.0,Sun/Oracle C++12.0 , --->this declaration is allowed int Comeau C/C++ -->not allowed
That doesn't look like it would ever be a legal function declaration of any kind, much less for a destructor. I'm not positive what that part of the standard is talking about, but I have a guess.
I suspect there is a qualifier saying that your function is being called on an rvalue reference. Something like this:
class A {
public:
void IAmAnRValue() &&;
};
I think the language in the standard is saying that this qualifier is not allowed on a destructor, much like having a trailing const
would also be illegal.
And, on further investigation, my certainty of the correctness of my surmise goes up considerably. Here is the justification:
*this
.There it clearly states that functions may now have a 'ref-qualifier' after the 'cv-qualifer'. This means that a function declaration may now be followed by const &
or const volatile &&
instead of just const
. And the term used (ref-qualifier) is the same as the term used in the little bit of the standard you're quoting. And it makes sense for destructors to not be able to have one.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With