default parameters problem

Jason Merrill jason@yorick.cygnus.com
Tue Sep 2 23:26:00 GMT 1997


>>>>> Robert Wilhelm <robert@physiol.med.tu-muenchen.de> writes:

> Following code works with gcc 2.7.2,
> but not with egcs-970825:

> class T
> {
>   public:
>   T(int n=0, bool b1=false, char *s ="" , bool b2=false);
> };

> f()
> {
>      T * tp = new T[10](1,true,"");
> }


> $ gcc -v
> Reading specs from /usr/lib/gcc-lib/i486-linux/2.7.2/specs
> gcc version 2.7.2
> $ gcc -S t.C
> $
> $ /home/robert/gcc/bin/egcs-ss-970825/bin/gcc -v    
> Reading specs from /home/robert/gcc/bin/egcs-ss-970825/lib/gcc-lib/i686-pc-linux-gnulibc1/egcs-2.90.02/specs
> gcc version egcs-2.90.02 970825 (gcc2-970802 experimental)
> $ /home/robert/gcc/bin/egcs-ss-970825/bin/gcc t.C 
> t.C: In function `int f()':
> t.C:10: no matching function for call to `T::T (char *)'
> t.C:6: candidates are: T::T(const T &)
> t.C:5:                 T::T(int, bool, char *, bool)

The problem is that expand_vec_init is treating the constructor parameters
as a compound expression.  I'm not liable to fix this any time soon; anyone
is welcome to take a look at it.

Jason



More information about the Gcc-bugs mailing list