gcc-2.95.2, 'nested ctors' compilation exits

Bjorn Wennberg bjornw@tihlde.org
Tue Nov 2 11:49:00 GMT 1999


Evening!

I've just installed gcc-2.95.2 over my old egcs-1.1.1. I'm now
trying to compile my source. It seems like gcc-2.95.2 has problems
using 'nested' ctors in declaration.

Below is an example-file that gcc-2.95.2 woes on.

egcs-1.1.2, egcs-1.1.1 and earlier version of egcs compiles this
without problems.

bjornw>
--
-------------------------------------------------------
Bjørn Wennberg       email: bjornw@tihlde.org
                        ms: +47 9599 2657


# g++ -c g.cc
g.cc: In function `int main()':
g.cc:39: parse error before `,'

# g++ -DFUNNY -c g.cc
g.cc: In function `int main()':
g.cc:38: `CDbExpr' undeclared (first use this function)
g.cc:38: (Each undeclared identifier is reported only once
g.cc:38: for each function it appears in.)
g.cc:38: parse error before `('

--------------------------- g.cc ----------------------------
enum eq_op {
   eq_less,
   eq_equal,
   eq_greater
};

enum cond_op {
   cond_and,
   cond_or
};

class CDbExpr
{
   public:
      CDbExpr(const CDbExpr &Other);
      CDbExpr(const char *,    eq_op,   const char *);
      CDbExpr(const CDbExpr &, cond_op, const CDbExpr &);
};

int
main()
{
#ifdef FUNNY
   CDbExpr Expr1("id", eq_equal, "1");
   // works ok

   CDbExpr Expr2(Expr1, cond_and, Expr1);
   // works ok

   CDbExpr Expr3(CDbExpr(Expr1, cond_and, Expr2), cond_and, CDbExpr(Expr1, cond_and, Expr2));
   // works ok

   CDbExpr Expr4(CDbExpr(CDbExpr("id", eq_equal, "1")));
   // works ok
#endif

   CDbExpr Expr5(
      CDbExpr(
	 CDbExpr("id", eq_equal, "1"),
	 cond_and,
	 CDbExpr("name", eq_equal, "bob")),
      cond_and,
      CDbExpr("age", eq_equal, "30"));
}



More information about the Gcc-bugs mailing list