This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
c++/9687: The & operator does not accept parentheses on operand
- From: marc dot durantez at jp dot sony dot com
- To: gcc-gnats at gcc dot gnu dot org
- Date: 13 Feb 2003 09:12:00 -0000
- Subject: c++/9687: The & operator does not accept parentheses on operand
- Reply-to: marc dot durantez at jp dot sony dot com
>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: