public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/49389] New: [C++0x] Wrong value category for pointer-to-member expression with rvalue object expression
@ 2011-06-13 11:19 daniel.kruegler at googlemail dot com
  2011-06-14 18:16 ` [Bug c++/49389] " jason at gcc dot gnu.org
  2011-06-15  3:57 ` jason at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: daniel.kruegler at googlemail dot com @ 2011-06-13 11:19 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: [C++0x] Wrong value category for pointer-to-member
                    expression with rvalue object expression
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: daniel.kruegler@googlemail.com
                CC: jason@redhat.com


gcc 4.7.0 20110611 (experimental) in C++0x mode rejects the following program
at the line marked with #:

//----
template<class T>
T&& val();

struct A {};

typedef decltype(val<A>().*val<int A::*>()) type;

template<class>
struct assert_type;

template<>
struct assert_type<int&&> {};

assert_type<type> test; // #
//----

"error: aggregate 'assert_type<int&> test' has incomplete type and cannot be
defined"

Further testing reveals that the deduced type is 'int&' instead of 'int&&'.

According to my reading of 5.5 [expr.mptr.oper] p6:

"The result of a .* expression whose second operand is a pointer to a data
member is of the same value category (3.10) as its first operand."

we have an xvalue expression val<A>() as the first operand, which should result
in an xvalue expression category for the complete pointer-to-member expression.

Referring to 7.1.6.2 [dcl.type.simple] p4, we should fall into bullet 2:

"otherwise, if e is an xvalue, decltype(e) is T&&, where T is the type of e;"

which should have the effect of returning int&&, not int&. Therefore gcc should
accept this program.


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

* [Bug c++/49389] [C++0x] Wrong value category for pointer-to-member expression with rvalue object expression
  2011-06-13 11:19 [Bug c++/49389] New: [C++0x] Wrong value category for pointer-to-member expression with rvalue object expression daniel.kruegler at googlemail dot com
@ 2011-06-14 18:16 ` jason at gcc dot gnu.org
  2011-06-15  3:57 ` jason at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: jason at gcc dot gnu.org @ 2011-06-14 18:16 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Jason Merrill <jason at gcc dot gnu.org> 2011-06-14 18:16:00 UTC ---
Author: jason
Date: Tue Jun 14 18:15:58 2011
New Revision: 175043

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=175043
Log:
    PR c++/49389
    * typeck2.c (build_m_component_ref): Preserve rvalueness.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/rv-dotstar.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/typeck2.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug c++/49389] [C++0x] Wrong value category for pointer-to-member expression with rvalue object expression
  2011-06-13 11:19 [Bug c++/49389] New: [C++0x] Wrong value category for pointer-to-member expression with rvalue object expression daniel.kruegler at googlemail dot com
  2011-06-14 18:16 ` [Bug c++/49389] " jason at gcc dot gnu.org
@ 2011-06-15  3:57 ` jason at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: jason at gcc dot gnu.org @ 2011-06-15  3:57 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
                 CC|jason at redhat dot com     |jason at gcc dot gnu.org
         Resolution|                            |FIXED
         AssignedTo|unassigned at gcc dot       |jason at gcc dot gnu.org
                   |gnu.org                     |
   Target Milestone|---                         |4.7.0

--- Comment #2 from Jason Merrill <jason at gcc dot gnu.org> 2011-06-15 03:56:11 UTC ---
Fixed for 4.7.


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

end of thread, other threads:[~2011-06-15  3:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-13 11:19 [Bug c++/49389] New: [C++0x] Wrong value category for pointer-to-member expression with rvalue object expression daniel.kruegler at googlemail dot com
2011-06-14 18:16 ` [Bug c++/49389] " jason at gcc dot gnu.org
2011-06-15  3:57 ` 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).