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: [email protected]
ReportedBy: [email protected]
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