This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/50835] New: [4.7 Regression] Lvalue-ness of conditional operator results is incorrect in a function template
- From: "mimomorin at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sun, 23 Oct 2011 02:10:36 +0000
- Subject: [Bug c++/50835] New: [4.7 Regression] Lvalue-ness of conditional operator results is incorrect in a function template
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50835
Bug #: 50835
Summary: [4.7 Regression] Lvalue-ness of conditional operator
results is incorrect in a function template
Classification: Unclassified
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: mimomorin@gmail.com
Created attachment 25578
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=25578
Test case (which incorrectly fails to be compiled on gcc-4.7)
Suppose we have the following class
template<typename T>
struct rvalue_probe
{
explicit rvalue_probe(T &t) : value(t) {}
operator T () { return value; }
operator T&() const { return value; }
T& value;
};
Then,
// std::vector<int> v;
true ? rvalue_probe<std::vector<int> >(v) : v
should be evaluated to an lvalue.
But in a function template, this is incorrectly evaluated to an rvalue.
Tested on gcc-4.7.0 20111022 (in a C++03 mode).