c++/9687: The & operator does not accept parentheses on operand
marc.durantez@jp.sony.com
marc.durantez@jp.sony.com
Thu Feb 13 09:16:00 GMT 2003
>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:
More information about the Gcc-bugs
mailing list