Bug#138561: g++: parse errors in nested constructor calls
Package: g++
Version: 2:2.95.4-9
Severity: normal
I got strange parse errors in nested constructor calls with both, g++-2.95
and g++-3.0. I was able to create a minimal c++ source file which
reproduces the error:
--------------------------------------------------------------------------
class C1 {
public:
C1 (double _x, double _y): x(_x), y(_y) {}
private:
double x, y;
};
class C2 {
public:
C2 (const C1 &_c): c(_c) {}
private:
C1 c;
};
double f (double x) {
return x;
}
int main () {
double x = f(0.5), y = f(0.5);
C2 a (C1(x , y )); // this one works
C2 b (C1(f(0.5), f(0.5))); // this produces a parse error before `,'
}
------------------------------------------------------------------------
-- System Information
Debian Release: 3.0
Architecture: i386
Kernel: Linux viking 2.4.17 #32 Son Feb 24 22:21:14 CET 2002 i686
Locale: LANG=de_DE, LC_CTYPE=de_DE
Versions of packages g++ depends on:
ii cpp 2:2.95.4-9 The GNU C preprocessor.
ii g++-2.95 1:2.95.4-1 The GNU C++ compiler.
ii gcc-2.95 1:2.95.4-1 The GNU C compiler.
Reply to: