Error: constructor Foo.this default constructor for structs only allowed with @disable, no body, and no parameters

Nicholas Wilson via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Mar 7 05:23:58 PST 2016


struct Fence
{
	VkFence	fence;
	alias fence this;

	 static struct CreateInfo
	{
		 VkFenceCreateInfo	ci;
		 alias ci this;
		 this(
		       )
		{
		 ci = typeof(ci)(
		 cast(typeof(ci.sType))StructureType.eFenceCreateInfo,
		 null,
		 0);
		 }
	 }
}

I'm not quite sure what this error is saying. Is it that the only 
struct constructor that can have no parameters is @disable 
this(){} ?

If so this is rather annoying as I have to create a new code path 
for the generation of this and 7 other structs. What must the 
code be in this case?

  static struct CreateInfo
{
		 VkFenceCreateInfo	ci = 
VkFenceCreateInfo(cast(typeof(ci.sType))StructureType.eFenceCreateInfo,null,0);
		 alias ci this;
}
?


More information about the Digitalmars-d-learn mailing list