[Issue 2085] CTFE fails if the function is forward referenced
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat Mar 27 05:53:09 PDT 2010
http://d.puremagic.com/issues/show_bug.cgi?id=2085
Rainer Schuetze <r.sagitario at gmx.de> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |patch
CC| |r.sagitario at gmx.de
--- Comment #3 from Rainer Schuetze <r.sagitario at gmx.de> 2010-03-27 05:53:06 PDT ---
Here's patch that invokes the semantic on the function if referenced.
Additioally, it needs to avoid duplicate semantic to be run later.
This patch also fixes #3499
Index: expression.c
===================================================================
--- expression.c (revision 421)
+++ expression.c (working copy)
@@ -2427,7 +2427,8 @@
f = s->isFuncDeclaration();
if (f)
{ //printf("'%s' is a function\n", f->toChars());
-
+ if (!f->originalType && f->scope) // semantic not yet run
+ f->semantic(f->scope);
if (!f->type->deco)
{
error("forward reference to %s", toChars());
Index: func.c
===================================================================
--- func.c (revision 421)
+++ func.c (working copy)
@@ -134,7 +134,7 @@
parent = sc->parent;
Dsymbol *parent = toParent();
- if (semanticRun == PASSsemanticdone)
+ if (semanticRun >= PASSsemanticdone) // BUG 2085
{
if (!parent->isClassDeclaration())
return;
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list