public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c++/9687: The & operator does not accept parentheses on operand
@ 2003-02-17 19:06 Wolfgang Bangerth
0 siblings, 0 replies; 4+ messages in thread
From: Wolfgang Bangerth @ 2003-02-17 19:06 UTC (permalink / raw)
To: nobody; +Cc: gcc-prs
The following reply was made to PR c++/9687; it has been noted by GNATS.
From: Wolfgang Bangerth <bangerth@ticam.utexas.edu>
To: Nathan Sidwell <nathan@codesourcery.com>
Cc: gcc-bugs@gcc.gnu.org, <marc.durantez@jp.sony.com>, <gcc-gnats@gcc.gnu.org>
Subject: Re: c++/9687: The & operator does not accept parentheses on operand
Date: Mon, 17 Feb 2003 13:01:07 -0600 (CST)
Nathan,
you might be right, thanks for double-checking on me. I shouldn't dismiss
reports late at night -- I misread this as the &(X::m) problem...
> Are you sure? &(T::member) is disallowed, but I don't think &(random_expr) is.
> Could you explain your deduction to me?
The relevant clause is 5.3.1.2, stating that the operand shall be an
lvalue. This has nothing to do with the parenthesis, of course, so I guess
you're right.
The present state is: 2.95--3.3 rejected the code. 3.4 now simply says
warning: taking address of temporary
I guess this improvement is the effect of your patch. So in effect the bug
has been fixed and the report can remain closed, right?
Thanks again for having an open eye,
W.
-------------------------------------------------------------------------
Wolfgang Bangerth email: bangerth@ticam.utexas.edu
www: http://www.ticam.utexas.edu/~bangerth/
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: c++/9687: The & operator does not accept parentheses on operand
@ 2003-02-15 12:16 Nathan Sidwell
0 siblings, 0 replies; 4+ messages in thread
From: Nathan Sidwell @ 2003-02-15 12:16 UTC (permalink / raw)
To: nobody; +Cc: gcc-prs
The following reply was made to PR c++/9687; it has been noted by GNATS.
From: Nathan Sidwell <nathan@codesourcery.com>
To: bangerth@dealii.org, gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org,
marc.durantez@jp.sony.com, nobody@gcc.gnu.org, gcc-gnats@gcc.gnu.org
Cc:
Subject: Re: c++/9687: The & operator does not accept parentheses on operand
Date: Sat, 15 Feb 2003 12:07:48 +0000
bangerth@dealii.org wrote:
> Synopsis: The & operator does not accept parentheses on operand
>
> State-Changed-From-To: open->closed
> State-Changed-By: bangerth
> State-Changed-When: Fri Feb 14 21:33:11 2003
> State-Changed-Why:
> The C++ standard even has wording to disallow using parentheses.
>
> Previous versions of gcc accepted the code erroneously. This
> has been fixed.
>
> http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9687
Are you sure? &(T::member) is disallowed, but I don't think &(random_expr) is.
Could you explain your deduction to me?
FWIW, I think this is a parse error as (MyClass ()) looks like a cast expression
to function type, without the trailing expr. I.e. It thought it was seeing
(MyClass ())thing
I fixed this in the new parser.
nathan
--
Nathan Sidwell :: http://www.codesourcery.com :: CodeSourcery LLC
The voices in my head said this was stupid too
nathan@codesourcery.com : http://www.cs.bris.ac.uk/~nathan/ : nathan@acm.org
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: c++/9687: The & operator does not accept parentheses on operand
@ 2003-02-14 21:33 bangerth
0 siblings, 0 replies; 4+ messages in thread
From: bangerth @ 2003-02-14 21:33 UTC (permalink / raw)
To: gcc-bugs, gcc-prs, marc.durantez, nobody
Synopsis: The & operator does not accept parentheses on operand
State-Changed-From-To: open->closed
State-Changed-By: bangerth
State-Changed-When: Fri Feb 14 21:33:11 2003
State-Changed-Why:
The C++ standard even has wording to disallow using parentheses.
Previous versions of gcc accepted the code erroneously. This
has been fixed.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9687
^ permalink raw reply [flat|nested] 4+ messages in thread
* c++/9687: The & operator does not accept parentheses on operand
@ 2003-02-13 9:16 marc.durantez
0 siblings, 0 replies; 4+ messages in thread
From: marc.durantez @ 2003-02-13 9:16 UTC (permalink / raw)
To: gcc-gnats
>Number: 9687
>Category: c++
>Synopsis: The & operator does not accept parentheses on operand
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: rejects-legal
>Submitter-Id: net
>Arrival-Date: Thu Feb 13 09:16:01 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator: Marc Durantez
>Release: g++ (GCC) 3.2.2
>Organization:
>Environment:
Turbolinux 7.0
>Description:
The & operator followed by an operand enclosed in
parentheses causes a parse error.
The following code gives a parse error on the line with
the &.
#include<iostream>
class MyClass
{
int i;
};
int main()
{
std::cout << (&(MyClass())) << "\n";
return 0;
}
The error message is
printLocal.cpp: In function `int main()':
printLocal.cpp:10: parse error before `)' token
As far as I understand ISO14882 the code above should
be legal. The code compiled without error on a
different compiler.
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2003-02-17 19:06 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-02-17 19:06 c++/9687: The & operator does not accept parentheses on operand Wolfgang Bangerth
-- strict thread matches above, loose matches on Subject: below --
2003-02-15 12:16 Nathan Sidwell
2003-02-14 21:33 bangerth
2003-02-13 9:16 marc.durantez
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).