On Sun, 22 Mar 2009 21:31:07 +0300, Steve Teale <steve.te...@britseyeview.com> 
wrote:

void str()
{
   auto s = new char[];
}

void main()
{
   str();
}

produces:

str.d(3): Error: new can only create structs, dynamic arrays or class objects, not char[]'s.

What am I missing here, isn't char[] a dynamic array?


Hmm.. Not a common case, but looks like a bug. Or a clever design decision :P

Certainly, you can create an int using new:

int* i = new int;

Why can't you create 'char[]'?

T create(T) {
   return new T;
}

int* i = create!(int); // fine
char[]* c = create!(char[]); // error

Reply via email to