public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/42655]  New: Don't qualify rvalues of non-class types
@ 2010-01-08  3:17 schaub-johannes at web dot de
  2010-01-08  3:23 ` [Bug c++/42655] ! causes the qualified types for rvalue pinskia at gcc dot gnu dot org
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: schaub-johannes at web dot de @ 2010-01-08  3:17 UTC (permalink / raw)
  To: gcc-bugs

GCC applies cv-qualifiers to rvalues of non-class types. The following code is
all right, but GCC doesn't like it:

template<typename T>
void unused(T const &) { }

int main() {
  volatile bool x = false;
  unused(!x); // type of "!x" is bool
}


-- 
           Summary: Don't qualify rvalues of non-class types
           Product: gcc
           Version: 4.4.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: schaub-johannes at web dot de
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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


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

* [Bug c++/42655] ! causes the qualified types for rvalue
  2010-01-08  3:17 [Bug c++/42655] New: Don't qualify rvalues of non-class types schaub-johannes at web dot de
@ 2010-01-08  3:23 ` pinskia at gcc dot gnu dot org
  2010-01-08  3:24 ` [Bug c++/42655] [4.3/4.4/4.5 Regression] " pinskia at gcc dot gnu dot org
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2010-01-08  3:23 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2010-01-08 03:22 -------
Looks like it is only an issue with ! (and bool) and not with any other
expression really.
template<typename T>
void unused(T const &) { }

int main() {
  volatile int x = false;
  unused(x-0); 
}

Causes unused<int>() to be called.

Also note !!x uses volatile bool which is also wrong.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid, wrong-code
            Summary|Don't qualify rvalues of    |! causes the qualified types
                   |non-class types             |for rvalue


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


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

* [Bug c++/42655] [4.3/4.4/4.5 Regression] ! causes the qualified types for rvalue
  2010-01-08  3:17 [Bug c++/42655] New: Don't qualify rvalues of non-class types schaub-johannes at web dot de
  2010-01-08  3:23 ` [Bug c++/42655] ! causes the qualified types for rvalue pinskia at gcc dot gnu dot org
@ 2010-01-08  3:24 ` pinskia at gcc dot gnu dot org
  2010-01-08  3:35 ` schaub-johannes at web dot de
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2010-01-08  3:24 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pinskia at gcc dot gnu dot org  2010-01-08 03:24 -------
Confirmed, a regression from at least 3.3.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
      Known to fail|                            |4.0.0 4.1.0 4.2.0 4.3.0
                   |                            |4.4.0 4.5.0
      Known to work|                            |3.3
   Last reconfirmed|0000-00-00 00:00:00         |2010-01-08 03:24:07
               date|                            |
            Summary|! causes the qualified types|[4.3/4.4/4.5 Regression] !
                   |for rvalue                  |causes the qualified types
                   |                            |for rvalue
   Target Milestone|---                         |4.3.5


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


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

* [Bug c++/42655] [4.3/4.4/4.5 Regression] ! causes the qualified types for rvalue
  2010-01-08  3:17 [Bug c++/42655] New: Don't qualify rvalues of non-class types schaub-johannes at web dot de
  2010-01-08  3:23 ` [Bug c++/42655] ! causes the qualified types for rvalue pinskia at gcc dot gnu dot org
  2010-01-08  3:24 ` [Bug c++/42655] [4.3/4.4/4.5 Regression] " pinskia at gcc dot gnu dot org
@ 2010-01-08  3:35 ` schaub-johannes at web dot de
  2010-01-08  3:41 ` schaub-johannes at web dot de
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: schaub-johannes at web dot de @ 2010-01-08  3:35 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from schaub-johannes at web dot de  2010-01-08 03:35 -------
The following are two other cases where GCC misses to drop qualifiers

  typedef int const intt;
  unused(intt()); // intt has type 'int'

  int const f();
  unused(f()); // f() has type 'int'


-- 


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


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

* [Bug c++/42655] [4.3/4.4/4.5 Regression] ! causes the qualified types for rvalue
  2010-01-08  3:17 [Bug c++/42655] New: Don't qualify rvalues of non-class types schaub-johannes at web dot de
                   ` (2 preceding siblings ...)
  2010-01-08  3:35 ` schaub-johannes at web dot de
@ 2010-01-08  3:41 ` schaub-johannes at web dot de
  2010-01-08  3:42 ` pinskia at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: schaub-johannes at web dot de @ 2010-01-08  3:41 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from schaub-johannes at web dot de  2010-01-08 03:40 -------
(Should have mentioned i did the second set of tests with a modified "unused"
having "T&" as parameter type, and relying on failure of binding of non-const
references to rvalues. GCC does not reject the two calls).


-- 


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


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

* [Bug c++/42655] [4.3/4.4/4.5 Regression] ! causes the qualified types for rvalue
  2010-01-08  3:17 [Bug c++/42655] New: Don't qualify rvalues of non-class types schaub-johannes at web dot de
                   ` (3 preceding siblings ...)
  2010-01-08  3:41 ` schaub-johannes at web dot de
@ 2010-01-08  3:42 ` pinskia at gcc dot gnu dot org
  2010-01-08  3:43 ` wkf at alum dot mit dot edu
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2010-01-08  3:42 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from pinskia at gcc dot gnu dot org  2010-01-08 03:42 -------
(In reply to comment #3)
> The following are two other cases where GCC misses to drop qualifiers

Those two works for me. they both call unused<int> in GCC 4.4 and the trunk. 
Though replace const with volatile, it fails for intt() case on the trunk and
both for 4.4.  Though this is a way different issue than originally reported
:).


-- 


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


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

* [Bug c++/42655] [4.3/4.4/4.5 Regression] ! causes the qualified types for rvalue
  2010-01-08  3:17 [Bug c++/42655] New: Don't qualify rvalues of non-class types schaub-johannes at web dot de
                   ` (4 preceding siblings ...)
  2010-01-08  3:42 ` pinskia at gcc dot gnu dot org
@ 2010-01-08  3:43 ` wkf at alum dot mit dot edu
  2010-01-08  3:43 ` pinskia at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: wkf at alum dot mit dot edu @ 2010-01-08  3:43 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from wkf at alum dot mit dot edu  2010-01-08 03:43 -------
This also fails on v3.4.6 where I first ran into it.  (I'd update the known to
fail line, but I don't have permission.)


-- 


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


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

* [Bug c++/42655] [4.3/4.4/4.5 Regression] ! causes the qualified types for rvalue
  2010-01-08  3:17 [Bug c++/42655] New: Don't qualify rvalues of non-class types schaub-johannes at web dot de
                   ` (5 preceding siblings ...)
  2010-01-08  3:43 ` wkf at alum dot mit dot edu
@ 2010-01-08  3:43 ` pinskia at gcc dot gnu dot org
  2010-01-09 12:45 ` jason at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2010-01-08  3:43 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from pinskia at gcc dot gnu dot org  2010-01-08 03:43 -------
(In reply to comment #4)
> (Should have mentioned i did the second set of tests with a modified "unused"
> having "T&" as parameter type, and relying on failure of binding of non-const
> references to rvalues. GCC does not reject the two calls).

Well the function call case has been fixed on the trunk as I mentioned in
comment #5.  But these are all different issues ...


-- 


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


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

* [Bug c++/42655] [4.3/4.4/4.5 Regression] ! causes the qualified types for rvalue
  2010-01-08  3:17 [Bug c++/42655] New: Don't qualify rvalues of non-class types schaub-johannes at web dot de
                   ` (6 preceding siblings ...)
  2010-01-08  3:43 ` pinskia at gcc dot gnu dot org
@ 2010-01-09 12:45 ` jason at gcc dot gnu dot org
  2010-01-14 16:37 ` rguenth at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: jason at gcc dot gnu dot org @ 2010-01-09 12:45 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|NEW                         |ASSIGNED
   Last reconfirmed|2010-01-08 03:24:07         |2010-01-09 12:45:04
               date|                            |


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


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

* [Bug c++/42655] [4.3/4.4/4.5 Regression] ! causes the qualified types for rvalue
  2010-01-08  3:17 [Bug c++/42655] New: Don't qualify rvalues of non-class types schaub-johannes at web dot de
                   ` (7 preceding siblings ...)
  2010-01-09 12:45 ` jason at gcc dot gnu dot org
@ 2010-01-14 16:37 ` rguenth at gcc dot gnu dot org
  2010-01-14 20:22 ` jason at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-01-14 16:37 UTC (permalink / raw)
  To: gcc-bugs



-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2


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


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

* [Bug c++/42655] [4.3/4.4/4.5 Regression] ! causes the qualified types for rvalue
  2010-01-08  3:17 [Bug c++/42655] New: Don't qualify rvalues of non-class types schaub-johannes at web dot de
                   ` (8 preceding siblings ...)
  2010-01-14 16:37 ` rguenth at gcc dot gnu dot org
@ 2010-01-14 20:22 ` jason at gcc dot gnu dot org
  2010-01-14 20:42 ` jason at gcc dot gnu dot org
  2010-01-14 20:46 ` jason at gcc dot gnu dot org
  11 siblings, 0 replies; 13+ messages in thread
From: jason at gcc dot gnu dot org @ 2010-01-14 20:22 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from jason at gcc dot gnu dot org  2010-01-14 20:22 -------
Subject: Bug 42655

Author: jason
Date: Thu Jan 14 20:21:58 2010
New Revision: 155913

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=155913
Log:
        PR c++/42655
        * call.c (convert_like_real): Do full decay_conversion for ck_rvalue.

Added:
    trunk/gcc/testsuite/g++.dg/overload/rvalue1.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/call.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug c++/42655] [4.3/4.4/4.5 Regression] ! causes the qualified types for rvalue
  2010-01-08  3:17 [Bug c++/42655] New: Don't qualify rvalues of non-class types schaub-johannes at web dot de
                   ` (9 preceding siblings ...)
  2010-01-14 20:22 ` jason at gcc dot gnu dot org
@ 2010-01-14 20:42 ` jason at gcc dot gnu dot org
  2010-01-14 20:46 ` jason at gcc dot gnu dot org
  11 siblings, 0 replies; 13+ messages in thread
From: jason at gcc dot gnu dot org @ 2010-01-14 20:42 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from jason at gcc dot gnu dot org  2010-01-14 20:42 -------
Subject: Bug 42655

Author: jason
Date: Thu Jan 14 20:42:16 2010
New Revision: 155915

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=155915
Log:
        PR c++/42655
        * call.c (convert_like_real): Do full decay_conversion for ck_rvalue.

Added:
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/overload/rvalue1.C
Modified:
    branches/gcc-4_4-branch/gcc/cp/ChangeLog
    branches/gcc-4_4-branch/gcc/cp/call.c
    branches/gcc-4_4-branch/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug c++/42655] [4.3/4.4/4.5 Regression] ! causes the qualified types for rvalue
  2010-01-08  3:17 [Bug c++/42655] New: Don't qualify rvalues of non-class types schaub-johannes at web dot de
                   ` (10 preceding siblings ...)
  2010-01-14 20:42 ` jason at gcc dot gnu dot org
@ 2010-01-14 20:46 ` jason at gcc dot gnu dot org
  11 siblings, 0 replies; 13+ messages in thread
From: jason at gcc dot gnu dot org @ 2010-01-14 20:46 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from jason at gcc dot gnu dot org  2010-01-14 20:45 -------
Fixed in 4.4, 4.5; not fixing in 4.3.


-- 

jason at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


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


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

end of thread, other threads:[~2010-01-14 20:46 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-01-08  3:17 [Bug c++/42655] New: Don't qualify rvalues of non-class types schaub-johannes at web dot de
2010-01-08  3:23 ` [Bug c++/42655] ! causes the qualified types for rvalue pinskia at gcc dot gnu dot org
2010-01-08  3:24 ` [Bug c++/42655] [4.3/4.4/4.5 Regression] " pinskia at gcc dot gnu dot org
2010-01-08  3:35 ` schaub-johannes at web dot de
2010-01-08  3:41 ` schaub-johannes at web dot de
2010-01-08  3:42 ` pinskia at gcc dot gnu dot org
2010-01-08  3:43 ` wkf at alum dot mit dot edu
2010-01-08  3:43 ` pinskia at gcc dot gnu dot org
2010-01-09 12:45 ` jason at gcc dot gnu dot org
2010-01-14 16:37 ` rguenth at gcc dot gnu dot org
2010-01-14 20:22 ` jason at gcc dot gnu dot org
2010-01-14 20:42 ` jason at gcc dot gnu dot org
2010-01-14 20:46 ` 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).