This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/50835] [4.7 Regression] Lvalue-ness of conditional operator results is incorrect in a function template


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50835

--- Comment #1 from Daniel KrÃgler <daniel.kruegler at googlemail dot com> 2011-10-23 11:47:19 UTC ---
Simplified test case:

//---
template<typename>
struct vector {};

template<typename T>
struct rvalue_probe
{
    explicit rvalue_probe(T &t) : value(t) {}

    operator T&() const { return value; }

    T& value;
};

template <typename T>
void should_be_lvalue(T&)
{
}

template <typename>
void f()
{
    vector<int> v;
    should_be_lvalue(true ? rvalue_probe<vector<int> >(v) : v); // Error
}
//---

The problem exists in C++0x mode as well.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]