mirror of
https://github.com/dlang/dmd.git
synced 2025-04-28 14:10:11 +03:00
Fix 15668: __LINE__ evaluated at declaration context
Relevant argument deduction code was using declaration `loc` instead of instantiation `instLoc`
This commit is contained in:
parent
31232a9c64
commit
43ffdd08fa
2 changed files with 11 additions and 2 deletions
|
@ -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;
|
||||
|
@ -1453,7 +1453,7 @@ public:
|
|||
}
|
||||
else
|
||||
{
|
||||
oded = tparam.defaultArg(loc, paramscope);
|
||||
oded = tparam.defaultArg(instLoc, paramscope);
|
||||
if (oded)
|
||||
(*dedargs)[i] = declareParameter(paramscope, tparam, oded);
|
||||
}
|
||||
|
|
9
test/compilable/test15668.d
Normal file
9
test/compilable/test15668.d
Normal file
|
@ -0,0 +1,9 @@
|
|||
void foo ( int line = __LINE__ ) ( string msg = "" )
|
||||
{
|
||||
static assert (line == 8);
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
foo();
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue