public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "daniel.kruegler at googlemail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/49389] New: [C++0x] Wrong value category for pointer-to-member expression with rvalue object expression Date: Mon, 13 Jun 2011 11:19:00 -0000 [thread overview] Message-ID: <bug-49389-4@http.gcc.gnu.org/bugzilla/> (raw) 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.
next reply other threads:[~2011-06-13 11:19 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top 2011-06-13 11:19 daniel.kruegler at googlemail dot com [this message] 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
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-49389-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).