digitalmars.D.bugs - [Issue 15309] New: [dmd-internal] ScopeExp.semantic() should set its
- via Digitalmars-d-bugs (43/43) Nov 09 2015 https://issues.dlang.org/show_bug.cgi?id=15309
https://issues.dlang.org/show_bug.cgi?id=15309 Issue ID: 15309 Summary: [dmd-internal] ScopeExp.semantic() should set its type always Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: normal Priority: P1 Component: druntime Assignee: nobody puremagic.com Reporter: k.hara.pg gmail.com Expression.semantic should set the 'type' field when the semantic analysis process succeeds. However ScopeExp.semantic may leave it as 'null'. Look at this snippet. int foo(T, U...)(U arg) { return 0; } void main() { auto x = foo!int; } // 'foo!int' is parsed as ScopeExp. When you compile the code, it will pass a problematic code path. override Expression semantic(Scope* sc) { ... ScopeDsymbol sds2 = sds; TemplateInstance ti = sds2.isTemplateInstance(); while (ti) { ... if (ti.needsTypeInference(sc)) { if (auto td = ti.tempdecl.isTemplateDeclaration()) { ... } else if (auto os = ti.tempdecl.isOverloadSet()) { ... } /* here, this.type will leave as 'null' */ return this; } ... --
Nov 09 2015