Skip to content

Commit

Permalink
Merge pull request #5441 from Dicebot/fix-15668-default-line
Browse files Browse the repository at this point in the history
Fix 15668: __LINE__ evaluated at declaration context
  • Loading branch information
9rnsr committed Feb 11, 2016
2 parents 31232a9 + 43ffdd0 commit 8ec7ea9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/dtemplate.d
Expand Up @@ -1435,7 +1435,7 @@ public:
* the oded == oarg
*/
(*dedargs)[i] = oded;
MATCH m2 = tparam.matchArg(loc, paramscope, dedargs, i, parameters, dedtypes, null);
MATCH m2 = tparam.matchArg(instLoc, paramscope, dedargs, i, parameters, dedtypes, null);
//printf("m2 = %d\n", m2);
if (m2 <= MATCHnomatch)
goto Lnomatch;
Expand All @@ -1453,7 +1453,7 @@ public:
}
else
{
oded = tparam.defaultArg(loc, paramscope);
oded = tparam.defaultArg(instLoc, paramscope);
if (oded)
(*dedargs)[i] = declareParameter(paramscope, tparam, oded);
}
Expand Down
9 changes: 9 additions & 0 deletions test/compilable/test15668.d
@@ -0,0 +1,9 @@
void foo ( int line = __LINE__ ) ( string msg = "" )
{
static assert (line == 8);
}

void main()
{
foo();
}

0 comments on commit 8ec7ea9

Please sign in to comment.