c++/880: Return type of type operator is not equivalent to return type of member function.
johan@tiq.com
johan@tiq.com
Fri Nov 24 11:56:00 GMT 2000
>Number: 880
>Category: c++
>Synopsis: Return type of type operator is not equivalent to return type of member function.
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: unassigned
>State: open
>Class: rejects-legal
>Submitter-Id: net
>Arrival-Date: Fri Nov 24 11:56:00 PST 2000
>Closed-Date:
>Last-Modified:
>Originator: Johan Hanson
>Release: 2.97
>Organization:
>Environment:
Linux/x86
>Description:
When a type operator and a member function both have
the same return type in their prototypes, their return
values can not be used in the same way.
Look in the attached source code.
I am no expert on the C++ standard, but this behaviour
is a bit inconsistent and looks like a bug to me! =)
Note: This was first tested on egcs 2.91.66 under x86/Linux, Red Hat 6.1
but has also been tested with the on-line test compiler on the GNU website.
>How-To-Repeat:
Compile the attached file.
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="cpptest.cpp"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="cpptest.cpp"
LyoKCWVnY3MgMi45MS42NiBvdXRwdXRzIGFuIGVycm9yIG1lc3NhZ2Ugd2hlbiBhdHRlbXB0aW5n
IHRvIGNvbXBpbGUgdGhpcyBmaWxlLgoqLwoKdHlwZWRlZiBmbG9hdCBWZWMyWzJdOwoKY2xhc3Mg
dmVjMiB7CiAgICBwcml2YXRlOgoJVmVjMgl2OwoJCiAgICBwdWJsaWM6CQoJb3BlcmF0b3IgVmVj
MiAmICgpIHsKCQlyZXR1cm4gdjsKCX0KCQoJVmVjMiAmIGFzVmVjMiAoKSB7CgkJcmV0dXJuIHY7
Cgl9Cn07CgpWZWMyICYgZnVuYyAoVmVjMiAmIHYpIHsKCXJldHVybiB2Owp9CgppbnQgbWFpbiAo
aW50IGFyZ2MsIGNoYXIgKiphcmd2KSB7CglWZWMyIFUsIFY7Cgl2ZWMyIHY7CgkKCVUgPSBWOwkJ
Ly8gYXJyYXktdG8tYXJyYXkgY29weQoJZmxvYXQgZiA9IHZbMF07CS8vIGltcGxpY2l0IGNhbGwg
dG8gdmVjMjo6b3BlcmF0b3IgVmVjMiAmICgpCglVID0gdi5hc1ZlYzIoKTsJLy8gZXhwbGljaXQg
Y29udmVyc2lvbgoJVSA9IGZ1bmMgKHYpOwkvLyBpbXBsaWNpdCBjYWxsIHRvIHZlYzI6Om9wZXJh
dG9yIFZlYzIgJiAoKQoKCVUgPSB2OwkJLy8gRXJyb3I6ICJpbmNvbXBhdGlibGUgdHlwZXMgaW4g
YXNzaWdubWVudCBvZiBgdmVjMicgdG8gYGZsb2F0WzJdJyIKCQkJLy8gTm93IHRoaXMgaXMgaW5j
b25zaXN0ZW50IGJlaGF2aW91ciBhbmQgc2VlbXMgdG8gbWUgYXMgYSBidWcuCn0K
More information about the Gcc-bugs
mailing list