c++/8914: parentheses not accepted around constructor call in return statement
tkarkanis@aw.sgi.com
tkarkanis@aw.sgi.com
Thu Dec 12 07:56:00 GMT 2002
>Number: 8914
>Category: c++
>Synopsis: parentheses not accepted around constructor call in return statement
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: rejects-legal
>Submitter-Id: net
>Arrival-Date: Thu Dec 12 07:56:01 PST 2002
>Closed-Date:
>Last-Modified:
>Originator: tkarkanis@aw.sgi.com
>Release: 3.2
>Organization:
>Environment:
Red Hat Linux
>Description:
If a return statement has parentheses around the expression, and the expression returns a temporary object created by calling the constructor without arguments, g++ emits a parse error. See attached file. This problem seems to exist in many versions of gcc. A workaround is to remove the parentheses enclosing the return expression.
>How-To-Repeat:
g++ -c return.cpp
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="return.cpp"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="return.cpp"
Y2xhc3MgRm9vCnsKcHVibGljOgogICAgRm9vKCk7CiAgICBGb28oIGludCApOwp9OwoKRm9vIGYo
KQp7CiAgICAvLyByZXR1cm4gRm9vKCk7ICAgICAgIC8vIHdvcmtzCiAgICAvLyByZXR1cm4oIEZv
bygwKSApOyAgIC8vIHdvcmtzCiAgICByZXR1cm4oIEZvbygpICk7ICAgICAgIC8vIGZhaWxzCn0K
More information about the Gcc-prs
mailing list