[Issue 15309] New: [dmd-internal] ScopeExp.semantic() should set its type always
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Mon Nov 9 17:25:25 PST 2015
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 at puremagic.com
Reporter: k.hara.pg at 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;
}
...
--
More information about the Digitalmars-d-bugs
mailing list