Thread overview
Some template code that worked in 2.065 is not working in 2.066
Aug 22, 2014
Uranuz
Aug 22, 2014
Dicebot
Aug 22, 2014
Vladimir Panteleev
Aug 23, 2014
Uranuz
August 22, 2014
In my project I have sort of complicated logic to implement data structure that is somehow similar to std.typecons.Tuple. I can't reproduce it, because I can't locate the source of bug. My code is like this but have more nested template "calls".

import std.stdio, std.typetuple;

struct MyLib(Args...)
{
	alias Symbols = _parseArgs!Args;
	
	template GetNames()
	{
		alias GetNames = Symbols;
	}
}


template _parseArgs(Args...)
{
	alias _parseArgs = TypeTuple!Args;
}

void main()
{
	auto myLib = MyLib!("a", "b", "c")();
	
	foreach( item; myLib.GetNames!() ) //Error: expression has no value
		writeln(item);

	//foreach( item; typeof(myLib).GetNames!() ) //This is working
	//	writeln(item);
}

Swapping lines that marked as error with commented lines makes it working. In this example error happens using 2.065 and 2.066, but in *my project*, where code is similar to this it compiles in 2.065 but fails in 2.066.

So what should be working in this example by language spec?
1. myLib.GetNames!()
2. typeof(myLib).GetNames!()
3. Both of the above

And it's interesting to see any reasons why this happens.
August 22, 2014
I believe it should work (it is no different from foreach(elem; myLib.Symbols) which works), but there are better experts on such topics hanging around.
August 22, 2014
On Friday, 22 August 2014 at 08:47:23 UTC, Uranuz wrote:
> In my project I have sort of complicated logic to implement data structure that is somehow similar to std.typecons.Tuple. I can't reproduce it, because I can't locate the source of bug.

You could try using DustMite:

https://github.com/CyberShadow/DustMite

You can try to reduce the program to a smallest one that compiles in one version, but doesn't in another:

https://github.com/CyberShadow/DustMite/wiki/Reducing-a-regression-between-two-D-versions

You could also use Digger to find the compiler change which caused your code to stop compiling:

https://github.com/CyberShadow/Digger
August 23, 2014
On Friday, 22 August 2014 at 17:08:39 UTC, Vladimir Panteleev wrote:
> On Friday, 22 August 2014 at 08:47:23 UTC, Uranuz wrote:
>> In my project I have sort of complicated logic to implement data structure that is somehow similar to std.typecons.Tuple. I can't reproduce it, because I can't locate the source of bug.
>
> You could try using DustMite:
>
> https://github.com/CyberShadow/DustMite
>
> You can try to reduce the program to a smallest one that compiles in one version, but doesn't in another:
>
> https://github.com/CyberShadow/DustMite/wiki/Reducing-a-regression-between-two-D-versions
>
> You could also use Digger to find the compiler change which caused your code to stop compiling:
>
> https://github.com/CyberShadow/Digger

Thanks. I have no experience with these instrumnets yet. For now I just changed mu code for using *typeof*. I'll try to locate the source of problem when I have some time.