Fix 15668: __LINE__ evaluated at declaration context

Relevant argument deduction code was using declaration `loc`
instead of instantiation `instLoc`
This commit is contained in:
Dicebot 2016-02-10 08:42:26 +02:00
parent 31232a9c64
commit 43ffdd08fa
2 changed files with 11 additions and 2 deletions

View file

@ -1435,7 +1435,7 @@ public:
* the oded == oarg * the oded == oarg
*/ */
(*dedargs)[i] = oded; (*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); //printf("m2 = %d\n", m2);
if (m2 <= MATCHnomatch) if (m2 <= MATCHnomatch)
goto Lnomatch; goto Lnomatch;
@ -1453,7 +1453,7 @@ public:
} }
else else
{ {
oded = tparam.defaultArg(loc, paramscope); oded = tparam.defaultArg(instLoc, paramscope);
if (oded) if (oded)
(*dedargs)[i] = declareParameter(paramscope, tparam, oded); (*dedargs)[i] = declareParameter(paramscope, tparam, oded);
} }

View file

@ -0,0 +1,9 @@
void foo ( int line = __LINE__ ) ( string msg = "" )
{
static assert (line == 8);
}
void main()
{
foo();
}