public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/19199] New: Wrong warning about returning a reference to a temporary
@ 2004-12-30 10:59 lars at trolltech dot com
  2004-12-30 14:49 ` [Bug c++/19199] [3.3/3.4/4.0 Regression] " pinskia at gcc dot gnu dot org
                   ` (38 more replies)
  0 siblings, 39 replies; 40+ messages in thread
From: lars at trolltech dot com @ 2004-12-30 10:59 UTC (permalink / raw)
  To: gcc-bugs

Hi, 
 
The code below produces a warning about returning a reference to a temporary 
when using enum types for the qMin method. It works fine when using primitive 
types or classes instead of enums. 
 
Fortunately it's rather easy to work around the warning :) 
 
Best regards, 
Lars 
 
 
enum Foo { A, B }; 
 
template<typename T> const T &qMin(const T &a, const T &b)  
{ return a < b ? a : b; } 
 
int main(int,  char **) 
{ 
    Foo f = A; 
    Foo g = B; 
    Foo h = qMin(f, g); 
    return 0; 
}

-- 
           Summary: Wrong warning about returning a reference to a temporary
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: lars at trolltech dot com
                CC: gcc-bugs at gcc dot gnu dot org


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


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

end of thread, other threads:[~2005-04-29 18:28 UTC | newest]

Thread overview: 40+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-12-30 10:59 [Bug c++/19199] New: Wrong warning about returning a reference to a temporary lars at trolltech dot com
2004-12-30 14:49 ` [Bug c++/19199] [3.3/3.4/4.0 Regression] " pinskia at gcc dot gnu dot org
2004-12-31 12:45 ` steven at gcc dot gnu dot org
2004-12-31 14:51 ` pinskia at gcc dot gnu dot org
2005-01-01  0:21 ` rth at gcc dot gnu dot org
2005-01-02  0:43 ` gdr at integrable-solutions dot net
2005-01-07  1:11 ` pinskia at gcc dot gnu dot org
2005-01-07  8:09 ` mmitchel at gcc dot gnu dot org
2005-01-09  4:46 ` rth at gcc dot gnu dot org
2005-01-26 18:02 ` amylaar at gcc dot gnu dot org
2005-01-27 23:08 ` amylaar at gcc dot gnu dot org
2005-03-04  8:13 ` [Bug c++/19199] [3.3/3.4/4.0/4.1 " mmitchel at gcc dot gnu dot org
2005-03-04 19:08 ` aoliva at redhat dot com
2005-03-06  0:14 ` mark at codesourcery dot com
2005-03-07  3:28 ` aoliva at redhat dot com
2005-03-07  4:19 ` mark at codesourcery dot com
2005-03-08 23:23 ` aoliva at redhat dot com
2005-03-09  1:29 ` roger at eyesopen dot com
2005-03-09  4:11 ` aoliva at redhat dot com
2005-03-25  6:04 ` roger at eyesopen dot com
2005-03-25  6:29 ` mark at codesourcery dot com
2005-03-30  2:55 ` aoliva at gcc dot gnu dot org
2005-03-30  7:20 ` mark at codesourcery dot com
2005-04-02 17:29 ` aoliva at redhat dot com
2005-04-03  3:20 ` roger at eyesopen dot com
2005-04-04  0:37 ` mark at codesourcery dot com
2005-04-04  5:02 ` cvs-commit at gcc dot gnu dot org
2005-04-04 13:32 ` aoliva at redhat dot com
2005-04-04 13:41 ` joseph at codesourcery dot com
2005-04-04 13:51 ` aoliva at redhat dot com
2005-04-04 15:03 ` aoliva at redhat dot com
2005-04-04 16:02 ` roger at eyesopen dot com
2005-04-04 16:40 ` mark at codesourcery dot com
2005-04-04 20:18 ` [Bug c++/19199] [3.3/3.4/4.0 " aoliva at redhat dot com
2005-04-04 23:01 ` mark at codesourcery dot com
2005-04-05  5:16 ` cvs-commit at gcc dot gnu dot org
2005-04-05 23:14 ` [Bug c++/19199] [3.3/3.4 " roger at eyesopen dot com
2005-04-05 23:49 ` mark at codesourcery dot com
2005-04-06  0:04 ` roger at eyesopen dot com
2005-04-29 18:28 ` mmitchel 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).