|
Boost : |
Subject: [boost] [type traits extension] test for const volatile& as return type
From: Frédéric Bron (frederic.bron_at_[hidden])
Date: 2011-07-05 15:50:32
I am still working on the extension of the type trait library to
operator detection.
I was pretty happy having now all my tests passing with g++, in
particular for all possible combinations of const, volatile and
reference.
I have now some troubles with the intel compiler. The following
program reproduces a part of the internal implementation of the
operator traits (with T defined below):
#include <iostream>
void g(T) { std::cout<<"g(T)\n"; }
void g(...) { std::cout<<"g(...)\n"; }
int main() {
int i(0);
g(i--);
return 0;
}
This is what I get with g++ 4.6.0 for different values of T:
- int&: g(...)
- const int&: g(T)
- volatile int&: g(...)
- const volatile int&: g(...)
This is what I get with intel 11.1:
- int&: g(...)
- const int&: g(T)
- volatile int&: g(...)
- const volatile int&: error: initial value of reference to const
volatile must be an lvalue
g++ is just fine for what I want to do but intel issues an error if T
is "const volatile&" so that the program cannot compile and the g(...)
is not chosen. Does anybody understands if this is the right behaviour
according to the standard or if g++ is right chosing g(...)?
Cheers,
Frédéric
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk