Skip to content

Commit

Permalink
Fixes Issue 7795 - Original type must be stored before semantic analy…
Browse files Browse the repository at this point in the history
…sis.
  • Loading branch information
AndrejMitrovic committed Oct 27, 2012
1 parent 6c01188 commit e3f3036
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/func.c
Expand Up @@ -3364,17 +3364,14 @@ void CtorDeclaration::semantic(Scope *sc)
tret = tret->addMod(type->mod);
}
tf->next = tret;
if (!originalType)
originalType = type->syntaxCopy();
type = type->semantic(loc, sc);

#if STRUCTTHISREF
if (ad && ad->isStructDeclaration())
{ if (!originalType)
originalType = type->syntaxCopy();
((TypeFunction *)type)->isref = 1;
}
#endif
if (!originalType)
originalType = type;

// Append:
// return this;
Expand Down
17 changes: 17 additions & 0 deletions test/compilable/ddoc7795.d
@@ -0,0 +1,17 @@
// PERMUTE_ARGS:
// REQUIRED_ARGS: -D -Ddtest_results/compilable -o-
// POST_SCRIPT: compilable/extra-files/ddocAny-postscript.sh 7795

module ddoc7795;

struct TimeValue {
this(int hour, int minute, int second = 0, int ms = 0) {}
}

///
struct DateTime {
///
this(TimeValue t = TimeValue(0, 0)) {}
}

void main() { }
19 changes: 19 additions & 0 deletions test/compilable/extra-files/ddoc7795.html
@@ -0,0 +1,19 @@
<html><head>
<META http-equiv="content-type" content="text/html; charset=utf-8">
<title>ddoc7795</title>
</head><body>
<h1>ddoc7795</h1>
<br><br>
<dl><dt><big><a name="DateTime"></a>struct <u>DateTime</u>;
</big></dt>
<dd><br><br>
<dl><dt><big><a name="DateTime.this"></a> this(TimeValue <i>t</i> = TimeValue(0,0));
</big></dt>
<dd><br><br>
</dd>
</dl>
</dd>
</dl>

<hr><small>Page generated by <a href="http://www.digitalmars.com/d/2.0/ddoc.html">Ddoc</a>. </small>
</body></html>

0 comments on commit e3f3036

Please sign in to comment.