public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/50835] New: [4.7 Regression] Lvalue-ness of conditional operator results is incorrect in a function template
@ 2011-10-23  2:10 mimomorin at gmail dot com
  2011-10-23 11:47 ` [Bug c++/50835] " daniel.kruegler at googlemail dot com
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: mimomorin at gmail dot com @ 2011-10-23  2:10 UTC (permalink / raw)
  To: gcc-bugs

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).


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2011-11-08 17:30 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-23  2:10 [Bug c++/50835] New: [4.7 Regression] Lvalue-ness of conditional operator results is incorrect in a function template mimomorin at gmail dot com
2011-10-23 11:47 ` [Bug c++/50835] " daniel.kruegler at googlemail dot com
2011-10-23 11:50 ` daniel.kruegler at googlemail dot com
2011-10-23 12:24 ` daniel.kruegler at googlemail dot com
2011-10-27  9:23 ` rguenth at gcc dot gnu.org
2011-10-27 11:36 ` rguenth at gcc dot gnu.org
2011-11-08 17:14 ` jason at gcc dot gnu.org
2011-11-08 17:31 ` jason at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).