My ignorance, or a bug - help please
Christophe
travert at phare.normalesup.org
Fri Oct 7 02:51:55 PDT 2011
Steve Teale , dans le message (digitalmars.D:146210), a écrit :
> I was converting something that was a class to a struct, and ran into this
> (minimized as much as possible):
>
> import mysql;
> // The import mysql.d for the test contains only:
> /*
> extern (C):
> struct MYSQL{}
> MYSQL* mysql_init(MYSQL* mysql);
> */
> // If I put this stuff in-line the error does not happen
>
> struct Connection
> {
> MYSQL _mysql;
>
> ~this()
> {
> }
>
> this(int dummy = 0)
> {
> mysql_init(&_mysql);
> }
> }
>
> // dmd -c mysqld.d (2.055 - Ubuntu)
> //
> // Error: can only initialize const member _mysql inside constructor
> // Error: this is not mutable
>
> Does anyone have any idea what's going on?
I don't know what is going one, but putting a MYSQL object in Connection
after having defined MYSQL as a dummy empty extern C struct does not
seem to be a good idea.
--
Christophe
More information about the Digitalmars-d
mailing list