www.digitalmars.com         C & C++   DMDScript  

D - error Can only concatenate arrays due to floating ','

reply "Mike Wynn" <mike.wynn l8night.co.uk> writes:
I assume that adding an extra comma ',' at the end of a param list should be
a syntax error.
the following causes the error
testcomma.d(17): Can only concatenate arrays
class Base {}
class Test : Base
{
 this( char c, ) {}
}

class TestToo
{
 this( char[] c, ) {}
}

int main( char[][] args )
{
 Base[] list;
 list ~= new Test( 'c' );
 list ~= new TestToo( 'this dont work' );
 return 0;
}

interestingly, removing the TestToo class and all refs to it (but leaving
Test with its constructor intact)
and it compiles O.K.

Mike.
Nov 02 2002
parent "Mike Wynn" <mike.wynn l8night.co.uk> writes:
its not the ','

its the missing ': Base' from
 class TestToo : Base
which was a typo, and actually the cause in my main source.
if you add that it compiles,

should it with the floating ','s ?


"Mike Wynn" <mike.wynn l8night.co.uk> wrote in message
news:aq1qeo$31at$1 digitaldaemon.com...
 I assume that adding an extra comma ',' at the end of a param list should

 a syntax error.
 the following causes the error
 testcomma.d(17): Can only concatenate arrays
 class Base {}
 class Test : Base
 {
  this( char c, ) {}
 }

 class TestToo
 {
  this( char[] c, ) {}
 }

 int main( char[][] args )
 {
  Base[] list;
  list ~= new Test( 'c' );
  list ~= new TestToo( 'this dont work' );
  return 0;
 }

 interestingly, removing the TestToo class and all refs to it (but leaving
 Test with its constructor intact)
 and it compiles O.K.

 Mike.

Nov 02 2002