D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 7700 - wrong semantic scope while ordering parameterized specialization
Summary: wrong semantic scope while ordering parameterized specialization
Status: NEW
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P3 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-03-13 05:14 UTC by Martin Nowak
Modified: 2024-12-13 17:59 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Martin Nowak 2012-03-13 05:14:43 UTC
cat > bug.d << CODE
template foo(short lo2, short hi2 : lo) {}
template foo(byte lo, byte hi : lo) {}

alias foo!(0, 0) foo00;
CODE

dmd -c bug

--------
bug.d(2): Error: undefined identifier lo, did you mean variable lo2?
--------

Both templates are match with conversion.
During ordering the first template is instantiated
with foo!(0, lo) and semantic is run in the wrong scope.

It seems that we need to create a scope and run semantic
while creating the dummy args.
Comment 1 Martin Nowak 2012-03-13 06:42:51 UTC
cat > bug.d << CODE
template foo(short lo2, short hi2 : lo2) {}
template foo(byte lo, byte hi : lo) {}

alias foo!(0, 0) foo00;
CODE

dmd -c bug

--------
bug.d(4): Error: undefined identifier lo, did you mean variable lo2?
bug.d(2): Error: undefined identifier lo2, did you mean variable lo?
bug.d(8): Error: template instance foo!(0,0) foo!(0,0) matches more than one template declaration, bug.d(2):foo(short lo2,short hi2 : lo2) and bug.d(4):foo(byte lo,byte hi : lo)
--------

There was a typo in the previous code example.
Comment 2 dlangBugzillaToGithub 2024-12-13 17:59:09 UTC
THIS ISSUE HAS BEEN MOVED TO GITHUB

https://github.com/dlang/dmd/issues/18426

DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB