Thread View: gnu.g++.bug
1 messages
1 total messages
Started by David.Detlefs
Mon, 24 Jul 1989 22:40
overloading problem
Author: David.Detlefs
Date: Mon, 24 Jul 1989 22:40
Date: Mon, 24 Jul 1989 22:40
39 lines
1310 bytes
1310 bytes
I'm using g++ 1.35 on a vax.
I extracted the following file from libg++'s "compare.h":
--------------------------------------------------
// This should work but doesn't.
inline int compare(int a, int b)
{
return a - b;
}
inline int compare(float a, float b)
{
float x = a - b;
return (x > 0.0 ? 1 : (x < 0.0 ? -1 : 0));
}
--------------------------------------------------
Attempting to compile this produced the error message:
In function int compare (float, float):
bug2.cc:9: conflicting types for `int compare (float, float)'
I then backed off to just declarations:
--------------------------------------------------
// This should *really* work but doesn't.
int compare(int a, int b);
int compare(float a, float b);
--------------------------------------------------
Result:
bug2b.cc:4: conflicting types for `int compare (float, float)'
-- Dave
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads