[Issue 14346] is-expression dependent on instantiation order
https://issues.dlang.org/show_bug.cgi?id=14346 RazvanN changed: What|Removed |Added Status|NEW |RESOLVED CC||razvan.nitu1...@gmail.com Resolution|--- |FIXED --- Comment #4 from RazvanN --- (In reply to ag0aep6g from comment #3) > Reduced further: > > > template typeOf(alias From) > { > alias typeOf = typeof(From); > } > > string val; > int embedded; > > void main() > { > foreach(UDA; Tuple!val) > { > pragma(msg, typeOf!UDA); /* prints "string", ok */ > } > foreach(UDA; Tuple!embedded) > { > /* THE RESULT OF THIS DEPENDS ON THE LINE ABOVE: */ > pragma(msg, typeOf!UDA); /* prints "string", should print "int" */ > } > } > > alias Tuple(stuff ...) = stuff; > > > This is very similar to issue 14501. When running the above code the second pragma prints int as expected. It seems that this has been fixed. --
[Issue 14346] is-expression dependent on instantiation order
https://issues.dlang.org/show_bug.cgi?id=14346 ag0ae...@gmail.com changed: What|Removed |Added CC||ag0ae...@gmail.com --- Comment #3 from ag0ae...@gmail.com --- Reduced further: template typeOf(alias From) { alias typeOf = typeof(From); } string val; int embedded; void main() { foreach(UDA; Tuple!val) { pragma(msg, typeOf!UDA); /* prints string, ok */ } foreach(UDA; Tuple!embedded) { /* THE RESULT OF THIS DEPENDS ON THE LINE ABOVE: */ pragma(msg, typeOf!UDA); /* prints string, should print int */ } } alias Tuple(stuff ...) = stuff; This is very similar to issue 14501. --
[Issue 14346] is-expression dependent on instantiation order
https://issues.dlang.org/show_bug.cgi?id=14346 ag0ae...@gmail.com changed: What|Removed |Added Keywords||wrong-code --
[Issue 14346] is-expression dependent on instantiation order
https://issues.dlang.org/show_bug.cgi?id=14346 --- Comment #2 from Ketmar Dark ket...@ketmar.no-ip.org --- ah. `usize` is simply an alias for `size_t`. sorry. --
[Issue 14346] is-expression dependent on instantiation order
https://issues.dlang.org/show_bug.cgi?id=14346 Ketmar Dark ket...@ketmar.no-ip.org changed: What|Removed |Added CC||ket...@ketmar.no-ip.org --- Comment #1 from Ketmar Dark ket...@ketmar.no-ip.org --- seems that there is some bug with template merging. change your template declarations to this: template isConvertibleToInstanceOf(alias From, alias To, usize dummy=__LINE__) template isConvertibleToInstanceOf(From, alias To, usize dummy=__LINE__) and you will never see pragma output from second `static if`. --