digitalmars.D.bugs - [Issue 1641] New: Template function arg deduction gets confused when used with the inner name trick
- d-bugmail puremagic.com (28/28) Nov 05 2007 http://d.puremagic.com/issues/show_bug.cgi?id=1641
- d-bugmail puremagic.com (14/14) Nov 05 2007 http://d.puremagic.com/issues/show_bug.cgi?id=1641
- d-bugmail puremagic.com (28/28) Nov 11 2007 http://d.puremagic.com/issues/show_bug.cgi?id=1641
- d-bugmail puremagic.com (11/11) Oct 21 2011 http://d.puremagic.com/issues/show_bug.cgi?id=1641
http://d.puremagic.com/issues/show_bug.cgi?id=1641
Summary: Template function arg deduction gets confused when used
with the inner name trick
Product: D
Version: 2.007
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P2
Component: DMD
AssignedTo: bugzilla digitalmars.com
ReportedBy: andrei metalanguage.com
The use case is simple:
template foo(T)
{
void foo(U)(U a, T b, T c)
{
}
}
void main()
{
int x;
foo!(uint)(x, 0, 1);
}
The template engine should properly bind 0 and 1 to type uint, but it fails to
do so. As a result, the entire program does not compile although it should.
--
Nov 05 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1641
shro8822 vandals.uidaho.edu changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |shro8822 vandals.uidaho.edu
If you convert the call to:
foo!(uint)(x, 0u, 1u);
or
foo!(int)(x, 0, 1);
it works. This might indicate that type conversion is not working correctly
here. Either way it gives a work around to any one who just need to get
something done.
--
Nov 05 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1641
smjg iname.com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |smjg iname.com
Keywords| |rejects-valid
Summary|Template function arg |Template function arg
|deduction gets confused when|deduction gets confused when
|used with the inner name |used with implicit
|trick |conversions
No nested template is required - this is sufficient to show the problem (DMD
1.023 and 2.007, Windows):
----------
void foo(U)(U a, uint b, uint c) {
}
void main() {
int x;
foo(x, 0, 1);
}
----------
bz1641a.d(6): template bz1641a.foo(U) does not match any template declaration
bz1641a.d(6): template bz1641a.foo(U) cannot deduce template function from
argument types (int,int,int)
----------
So the problem is that, when trying to perform IFTI, it doesn't look for
implicit conversions.
--
Nov 11 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1641
Kenji Hara <k.hara.pg gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
With git master (1ff6ad8509), the sample codes compile without error.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 21 2011









d-bugmail puremagic.com 