From 1747ac9b4be7c38f92164c898735531c34874f3f Mon Sep 17 00:00:00 2001 From: Martin Krejcirik Date: Sun, 14 Feb 2016 01:23:06 +0100 Subject: [PATCH] Merge pull request #5441 from Dicebot/fix-15668-default-line [REG2.068.0] Fix 15668: __LINE__ evaluated at declaration context Conflicts: src/dtemplate.d --- src/template.c | 4 ++-- test/compilable/test15668.d | 9 +++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 test/compilable/test15668.d diff --git a/src/template.c b/src/template.c index 1e9a77feb223..7eb7d811ca4c 100644 --- a/src/template.c +++ b/src/template.c @@ -1540,7 +1540,7 @@ MATCH TemplateDeclaration::deduceFunctionTemplateMatch( * 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; @@ -1558,7 +1558,7 @@ MATCH TemplateDeclaration::deduceFunctionTemplateMatch( } else { - oded = tparam->defaultArg(loc, paramscope); + oded = tparam->defaultArg(instLoc, paramscope); if (oded) (*dedargs)[i] = declareParameter(paramscope, tparam, oded); } diff --git a/test/compilable/test15668.d b/test/compilable/test15668.d new file mode 100644 index 000000000000..723521622001 --- /dev/null +++ b/test/compilable/test15668.d @@ -0,0 +1,9 @@ +void foo ( int line = __LINE__ ) ( string msg = "" ) +{ + static assert (line == 8); +} + +void main() +{ + foo(); +}