Boost logo

Boost :

Subject: Re: [boost] [type traits extension] test for const volatile& as return type
From: Edward Diener (eldiener_at_[hidden])
Date: 2011-07-05 22:19:57


On 7/5/2011 3:50 PM, Frédéric Bron wrote:
> 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"; }

template <class T> 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(...)?

I think you need to reproduce your exact case. Your code above can not
tell anyone what is actually going on.

I ran into Intel 11.1 and 12.0 problems in TTI if it makes you feel any
better, but that does not mean Intel is wrong and gcc is right in your case.

I am sorry I do not have Intel to test. I know they give a 30-day trial
but after that one has to pay and it is not that inexpensive.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk