www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - DMD FE confuzzled when taking object instantiations directly as parameters

For any valid constructor that takes an object as parameters, the
following code sample:

   Vector!(Options) vec = new Vector!(Options) (new
dpi.getopt.gnu.Option ("help", 'h', &test, "display help"),
                                                new
dpi.getopt.gnu.Option ("debug", 'd', &test, "debugging info")); // Line
421

produces the following output from GDC:

   cvs.d:421: constructor dpi.getopt.gnu.Option.this () does not match
argument types (char[],char,void(*)(char[][]args...),char[],OptBias )
   cvs.d:421: Error: expected 4 arguments, not 5

   cvs.d:421: cannot implicitly convert expression (100) of type char to
OptMeth
   cvs.d:421: cannot cast char to OptMeth
   cvs.d:421: cannot implicitly convert expression (&test) of type
void(*)(char[][]args...) to char[]
   cvs.d:421: cannot cast void(*)(char[][]args...) to char[]
   cvs.d:421: cannot implicitly convert expression ("debugging info") of
type char[] to OptBias
   cvs.d:422: Vector!(Options ) is used as a type
   cvs.d:422: variable dpi.getopt.cvs.main.vec voids have no value
   cvs.d:422: Vector!(Options ) is used as a type
   cvs.d:422: new can only create structs, dynamic arrays or class
objects, not void's
   cvs.d:422: cannot implicitly convert expression (new void*(new Option
("help",104,&test,"display help",cast(OptBias)0xffffffffffffffff))) of
type void* to int
   cvs.d:422: declaration dpi.getopt.cvs.main.vec is already defined

I've sent David Friedman an e-mail, and he said that it's a problem
with the frontend.
A tarball containing the offending code is available at
http://nsantos.f2o.org/dpi-libs.tar.bz2.
Note that I've been getting reports of an error 403 being raised; if
you're using wget to
download the file, try using your browser.

I do not (technically, can not) follow the newsgroups, and can't post
through the Web
frontend (it requires JavaScript, and I'm using Links); if anyone needs
additional
information, I'll be glad to give it.  If so, please send me a note to
neil_santos18 a.t. yahoo!.com
(humans, adjust accordingly).  I'm also usually on #d Freenode from
1600 UTC until a little bit before
midnight (again, UTC).

Thanks for your time.
Sep 25 2005