public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/37204]  New: reinterpret_cast<T&&>(v) incorrectly yields an lvalue
@ 2008-08-22 20:30 gcc-bugzilla at contacts dot eelis dot net
  2008-08-22 20:45 ` [Bug c++/37204] [c++0x] " paolo dot carlini at oracle dot com
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: gcc-bugzilla at contacts dot eelis dot net @ 2008-08-22 20:30 UTC (permalink / raw)
  To: gcc-bugs

Consider:

  #include <iostream>
  void f(int &) { std::cout << "lvalue\n"; }
  void f(int &&) { std::cout << "rvalue\n"; }
  int main() { int x(3); f(reinterpret_cast<int&&>(x)); }

This /should/ output "rvalue", but it outputs "lvalue" instead (when compiled
with -std=c++0x).

In 5.2.10p1, n2691 (the most recent C++0x draft) states w.r.t.
reinterpret_cast<T>(v):

  "If T is an lvalue reference type, the result is an lvalue; otherwise, the
result is an rvalue"


-- 
           Summary: reinterpret_cast<T&&>(v) incorrectly yields an lvalue
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: gcc-bugzilla at contacts dot eelis dot net


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


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

* [Bug c++/37204] [c++0x] reinterpret_cast<T&&>(v) incorrectly yields an lvalue
  2008-08-22 20:30 [Bug c++/37204] New: reinterpret_cast<T&&>(v) incorrectly yields an lvalue gcc-bugzilla at contacts dot eelis dot net
@ 2008-08-22 20:45 ` paolo dot carlini at oracle dot com
  2009-10-08 17:51 ` jason at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: paolo dot carlini at oracle dot com @ 2008-08-22 20:45 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from paolo dot carlini at oracle dot com  2008-08-22 20:43 -------
The usual CC...


-- 

paolo dot carlini at oracle dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |doug dot gregor at gmail dot
                   |                            |com
            Summary|reinterpret_cast<T&&>(v)    |[c++0x]
                   |incorrectly yields an lvalue|reinterpret_cast<T&&>(v)
                   |                            |incorrectly yields an lvalue


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


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

* [Bug c++/37204] [c++0x] reinterpret_cast<T&&>(v) incorrectly yields an lvalue
  2008-08-22 20:30 [Bug c++/37204] New: reinterpret_cast<T&&>(v) incorrectly yields an lvalue gcc-bugzilla at contacts dot eelis dot net
  2008-08-22 20:45 ` [Bug c++/37204] [c++0x] " paolo dot carlini at oracle dot com
@ 2009-10-08 17:51 ` jason at gcc dot gnu dot org
  2009-10-12  4:39 ` jason at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jason at gcc dot gnu dot org @ 2009-10-08 17:51 UTC (permalink / raw)
  To: gcc-bugs



-- 

jason at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |jason at gcc dot gnu dot org
                   |dot org                     |
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2009-10-08 17:50:56
               date|                            |


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


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

* [Bug c++/37204] [c++0x] reinterpret_cast<T&&>(v) incorrectly yields an lvalue
  2008-08-22 20:30 [Bug c++/37204] New: reinterpret_cast<T&&>(v) incorrectly yields an lvalue gcc-bugzilla at contacts dot eelis dot net
  2008-08-22 20:45 ` [Bug c++/37204] [c++0x] " paolo dot carlini at oracle dot com
  2009-10-08 17:51 ` jason at gcc dot gnu dot org
@ 2009-10-12  4:39 ` jason at gcc dot gnu dot org
  2009-10-12  4:41 ` jason at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jason at gcc dot gnu dot org @ 2009-10-12  4:39 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from jason at gcc dot gnu dot org  2009-10-12 04:39 -------
Subject: Bug 37204

Author: jason
Date: Mon Oct 12 04:39:04 2009
New Revision: 152661

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=152661
Log:
        PR c++/37204
        * typeck.c (build_reinterpret_cast_1): Handle rvalue refs
        properly.

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


-- 


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


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

* [Bug c++/37204] [c++0x] reinterpret_cast<T&&>(v) incorrectly yields an lvalue
  2008-08-22 20:30 [Bug c++/37204] New: reinterpret_cast<T&&>(v) incorrectly yields an lvalue gcc-bugzilla at contacts dot eelis dot net
                   ` (2 preceding siblings ...)
  2009-10-12  4:39 ` jason at gcc dot gnu dot org
@ 2009-10-12  4:41 ` jason at gcc dot gnu dot org
  2009-10-18  5:13 ` jason at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jason at gcc dot gnu dot org @ 2009-10-12  4:41 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from jason at gcc dot gnu dot org  2009-10-12 04:41 -------
Fixed for 4.5.  I'll also apply the fix for 4.4.3 after the 4.4.2 release goes
out.


-- 


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


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

* [Bug c++/37204] [c++0x] reinterpret_cast<T&&>(v) incorrectly yields an lvalue
  2008-08-22 20:30 [Bug c++/37204] New: reinterpret_cast<T&&>(v) incorrectly yields an lvalue gcc-bugzilla at contacts dot eelis dot net
                   ` (3 preceding siblings ...)
  2009-10-12  4:41 ` jason at gcc dot gnu dot org
@ 2009-10-18  5:13 ` jason at gcc dot gnu dot org
  2009-10-18  5:16 ` jason at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jason at gcc dot gnu dot org @ 2009-10-18  5:13 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from jason at gcc dot gnu dot org  2009-10-18 05:13 -------
Subject: Bug 37204

Author: jason
Date: Sun Oct 18 05:13:05 2009
New Revision: 152966

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=152966
Log:
        PR c++/38798
        * parser.c (CP_PARSER_FLAGS_NO_TYPE_DEFINITIONS): New.
        (cp_parser_type_specifier): Don't try to parse a class-specifier
        or enum-specifier in that case.
        (cp_parser_trailing_type_id): New.
        (cp_parser_late_return_type_opt): Call it.
        (cp_parser_type_id_1): Add is_trailing_return parm.
        (cp_parser_type_specifier_seq): Likewise.

        PR c++/40092
        * tree.c (cp_tree_equal): Add test for TEMPLATE_PARM_PARAMETER_PACK
        equality.

        PR c++/37875
        * parser.c (cp_parser_decltype): Set greater_than_is_operator_p.

        PR c++/37766
        * pt.c (type_unification_real): Call convert_template_argument
        for function default template arguments.
        (check_default_tmpl_args): Suggest -std=c++0x when function default
        template args seen in C++98 mode.

        PR c++/37204
        * typeck.c (build_reinterpret_cast_1): Handle rvalue refs
        properly.


Added:
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/cpp0x/decltype18.C
      - copied unchanged from r152686,
trunk/gcc/testsuite/g++.dg/cpp0x/decltype18.C
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/cpp0x/fntmpdefarg1.C
      - copied unchanged from r152686,
trunk/gcc/testsuite/g++.dg/cpp0x/fntmpdefarg1.C
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/cpp0x/rv-reinterpret.C
      - copied unchanged from r152661,
trunk/gcc/testsuite/g++.dg/cpp0x/rv-reinterpret.C
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/cpp0x/trailing1.C
      - copied unchanged from r152924,
trunk/gcc/testsuite/g++.dg/cpp0x/trailing1.C
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/cpp0x/trailing2.C
      - copied unchanged from r152924,
trunk/gcc/testsuite/g++.dg/cpp0x/trailing2.C
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/cpp0x/trailing3.C
      - copied unchanged from r152924,
trunk/gcc/testsuite/g++.dg/cpp0x/trailing3.C
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/cpp0x/trailing4.C
      - copied unchanged from r152924,
trunk/gcc/testsuite/g++.dg/cpp0x/trailing4.C
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/cpp0x/trailing5.C
      - copied unchanged from r152924,
trunk/gcc/testsuite/g++.dg/cpp0x/trailing5.C
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/cpp0x/vt-40092.C
      - copied unchanged from r152751,
trunk/gcc/testsuite/g++.dg/cpp0x/vt-40092.C
Removed:
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/cpp0x/auto12.C
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/cpp0x/auto13.C
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/cpp0x/auto6.C
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/cpp0x/auto8.C
Modified:
    branches/gcc-4_4-branch/gcc/cp/ChangeLog
    branches/gcc-4_4-branch/gcc/cp/parser.c
    branches/gcc-4_4-branch/gcc/cp/pt.c
    branches/gcc-4_4-branch/gcc/cp/tree.c
    branches/gcc-4_4-branch/gcc/cp/typeck.c
    branches/gcc-4_4-branch/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug c++/37204] [c++0x] reinterpret_cast<T&&>(v) incorrectly yields an lvalue
  2008-08-22 20:30 [Bug c++/37204] New: reinterpret_cast<T&&>(v) incorrectly yields an lvalue gcc-bugzilla at contacts dot eelis dot net
                   ` (4 preceding siblings ...)
  2009-10-18  5:13 ` jason at gcc dot gnu dot org
@ 2009-10-18  5:16 ` jason at gcc dot gnu dot org
  2009-10-18 17:58 ` mikpe at it dot uu dot se
  2009-10-19  7:41 ` jason at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: jason at gcc dot gnu dot org @ 2009-10-18  5:16 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from jason at gcc dot gnu dot org  2009-10-18 05:16 -------
Fixed for 4.4.3.


-- 

jason at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.4.3


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


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

* [Bug c++/37204] [c++0x] reinterpret_cast<T&&>(v) incorrectly yields an lvalue
  2008-08-22 20:30 [Bug c++/37204] New: reinterpret_cast<T&&>(v) incorrectly yields an lvalue gcc-bugzilla at contacts dot eelis dot net
                   ` (5 preceding siblings ...)
  2009-10-18  5:16 ` jason at gcc dot gnu dot org
@ 2009-10-18 17:58 ` mikpe at it dot uu dot se
  2009-10-19  7:41 ` jason at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: mikpe at it dot uu dot se @ 2009-10-18 17:58 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from mikpe at it dot uu dot se  2009-10-18 17:58 -------
Revision 152966 on 4.4 branch causes a testsuite regression for me on
i686-linux:

Running /mnt/builds/gcc-4.4-r152966/gcc/testsuite/g++.dg/dg.exp ...
FAIL: g++.dg/cpp0x/rv-reinterpret.C execution test

Reverting just the PR37204 bits eliminates that regression.


-- 

mikpe at it dot uu dot se changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mikpe at it dot uu dot se


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


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

* [Bug c++/37204] [c++0x] reinterpret_cast<T&&>(v) incorrectly yields an lvalue
  2008-08-22 20:30 [Bug c++/37204] New: reinterpret_cast<T&&>(v) incorrectly yields an lvalue gcc-bugzilla at contacts dot eelis dot net
                   ` (6 preceding siblings ...)
  2009-10-18 17:58 ` mikpe at it dot uu dot se
@ 2009-10-19  7:41 ` jason at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: jason at gcc dot gnu dot org @ 2009-10-19  7:41 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from jason at gcc dot gnu dot org  2009-10-19 07:41 -------
Thanks, though that's not a regression, that's the new PR37204 testcase.  The
execution test is testing direct binding, which is a separate issue that isn't
fixed in 4.4 yet, so I've just disabled the execution test on the 4.4 branch
for now.


-- 


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


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

end of thread, other threads:[~2009-10-19  7:41 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-08-22 20:30 [Bug c++/37204] New: reinterpret_cast<T&&>(v) incorrectly yields an lvalue gcc-bugzilla at contacts dot eelis dot net
2008-08-22 20:45 ` [Bug c++/37204] [c++0x] " paolo dot carlini at oracle dot com
2009-10-08 17:51 ` jason at gcc dot gnu dot org
2009-10-12  4:39 ` jason at gcc dot gnu dot org
2009-10-12  4:41 ` jason at gcc dot gnu dot org
2009-10-18  5:13 ` jason at gcc dot gnu dot org
2009-10-18  5:16 ` jason at gcc dot gnu dot org
2009-10-18 17:58 ` mikpe at it dot uu dot se
2009-10-19  7:41 ` jason at gcc dot gnu dot 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).