Some template code that worked in 2.065 is not working in 2.066
Uranuz via Digitalmars-d
digitalmars-d at puremagic.com
Fri Aug 22 01:47:22 PDT 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.
More information about the Digitalmars-d
mailing list