[type traits] issue with operator traits and volatile qualifier

Sorry for being absent during the last month but it was very hard to find any time to work on the addition of the operator traits. I have not yet had the time to deal with the naming issue... But I found something more tricky while trying to solve the issue of reference types (& was just ignored). I never used the volatile qualifier but I found that the following behaviour breaks the code that detects if an operator returns void or not. Could someone tell me why the following code does not compile? bool f() { } void g(const volatile bool &) { } int main() { g(f()); return 0; } Many thanks, Frédéric

AMDG On 05/25/2011 08:15 AM, Frédéric Bron wrote:
Sorry for being absent during the last month but it was very hard to find any time to work on the addition of the operator traits. I have not yet had the time to deal with the naming issue...
But I found something more tricky while trying to solve the issue of reference types (& was just ignored).
I never used the volatile qualifier but I found that the following behaviour breaks the code that detects if an operator returns void or not. Could someone tell me why the following code does not compile?
bool f() { } void g(const volatile bool &) { }
int main() { g(f()); return 0; }
A const volatile reference can't be bound to an rvalue. In Christ, Steven Watanabe

2011/5/25 Frédéric Bron <frederic.bron@m4x.org>
Could someone tell me why the following code does not compile?
bool f() { } void g(const volatile bool &) { }
int main() { g(f()); return 0; }
I think it falls out of temporaries cannot bind to non-const references, and a const volatile reference is not considered to be a const reference. -- Nevin ":-)" Liber <mailto:nevin@eviloverlord.com> (847) 691-1404
participants (3)
-
Frédéric Bron
-
Nevin Liber
-
Steven Watanabe