This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/51630] New: failure to detect missing
- From: "ramey at rrsd dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 20 Dec 2011 07:33:50 +0000
- Subject: [Bug c++/51630] New: failure to detect missing
- Auto-submitted: auto-generated
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