This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/14387] New: syntax problem with casting operator and extra parenthesises
- From: "serge dot bogdanov at intel dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 2 Mar 2004 18:19:59 -0000
- Subject: [Bug c++/14387] New: syntax problem with casting operator and extra parenthesises
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
The following code caused g++ syntax error. All strings in the 'main' are
functionally the same. The second one differs from the first only by parens
added around the rh expression. The last one differs in the way a casting
operator is expressed. 1 and 3 lines are OK. The second gives the following:
>> gcc/3.3.2/bin/g++ -c -I$sclasssrc -I$common/include e.cxx
e.cxx: In function `int main()':
e.cxx:16: error: parse error before `<<' token
Here is the code:
template <int MSB, int LSB>
struct Data {
Data();
operator unsigned ();
};
template<int EXTMSB, int EXTLSB>
struct Funct : public Data<EXTMSB - EXTLSB, 0> {
template<int MSB, int LSB>
Funct(const Data<MSB,LSB> &src);
};
Data<88,0> abc;
int main() {
unsigned x;
//x = unsigned(Funct<20,20>(abc)) << 1; // works
x = (unsigned(Funct<20,20>(abc)) << 1); // does not work
// x = ((unsigned)Funct<20,20>(abc) << 1) ; // works
return 0;
}
It produces the same error in 3.2.2
--
Summary: syntax problem with casting operator and extra
parenthesises
Product: gcc
Version: 3.3.2
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: serge dot bogdanov at intel dot com
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14387