bug in pragma?

JS js.mdnq at gmail.com
Thu Jul 4 15:29:20 PDT 2013


import std.stdio, std.cstream;


template test(alias x)
{
	string func()
	{
		string s = "beta";
		//pragma(msg, s);
		return s;
	}
	enum test = func();
}

void main(string[] args)
{
	mixin test!("alpha");
	din.getc();
}

When I try to display a compiler msg using pragma on a string 
variable the mixin fails. Commenting out the pragma allows the 
mixin to work.

While there may be some internal reason this shouldn't work it 
seems quite unnatural and took me a while to figure out it was 
pragma causing the problem in my code.





More information about the Digitalmars-d mailing list