My ignorance, or a bug - help please

Steve Teale steve.teale at britseyeview.com
Fri Oct 7 02:33:32 PDT 2011


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?

Thanks
Steve


More information about the Digitalmars-d mailing list