public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/51630] New: failure to detect missing
@ 2011-12-20  7:35 ramey at rrsd dot com
  2011-12-20  7:40 ` [Bug c++/51630] " ramey at rrsd dot com
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: ramey at rrsd dot com @ 2011-12-20  7:35 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 51630
           Summary: failure to detect missing
    Classification: Unclassified
           Product: gcc
           Version: 4.5.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: ramey@rrsd.com


Created attachment 26149
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=26149
program compiles with error when an error should be detected

the following code:

struct name {};

bool test1(){
    name x, y;
    return x < y;
}

name test2(){
    name x, y;
    return (x < y) ? y : x;
}

emits two error message as it should due to lack of < operator for name.

The following code:

template<typename T>
const T & max(const T & x, const T & y){
    return (x < y) ? y : x;
}

struct name {};

void test3(){
    name x, y, z;
    z = max(x, y); // error name doesn't have < operator
}

emits no error message.

This looks like a bug to me.  For what it's worth, this second example fails to
compile with MSVC 9.0 pointing to an error for lack of operator < as one would
expect.

Robert Ramey


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

end of thread, other threads:[~2011-12-21 16:15 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-20  7:35 [Bug c++/51630] New: failure to detect missing ramey at rrsd dot com
2011-12-20  7:40 ` [Bug c++/51630] " ramey at rrsd dot com
2011-12-20  8:59 ` redi at gcc dot gnu.org
2011-12-20  9:10 ` redi at gcc dot gnu.org
2011-12-20 10:31 ` paolo.carlini at oracle dot com
2011-12-20 21:22 ` ramey at rrsd dot com
2011-12-21  5:40 ` redi at gcc dot gnu.org
2011-12-21  7:22 ` ramey at rrsd dot com
2011-12-21 16:15 ` redi at gcc dot gnu.org
2011-12-21 16:20 ` redi 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).