<div dir="ltr"><div>Currently D will compile templated code that is syntactically correct but semantically always incorrect (ie regardless of template parameters), eg the following:</div><div>regardless of T, b is not in scope and hence this template cannot be instantiated without CT error.</div>
<div><br></div><div>So would it be possible to detect such kind of errors (ie CT error regardless of template params) without having to instantiate the template? Sure this could be detected with unittests in a perfect world but that gives an additional level of safety.</div>
<div><br></div><div>Likewise with template constraints, where the code wouldn't be able to compile given template constraints, but this case is harder.</div><div><br></div><div>----</div><div>void fun(T)(){</div><div>
  int a=b;</div><div>}</div><div><br></div><div>void main(){</div><div>  //fun!double; //uncomment for CT error</div><div>}</div><div><div>----</div></div><div><br></div></div>