digitalmars.D.bugs - [Issue 3600] New: template instantiation with empty tuple
- d-bugmail puremagic.com (37/37) Dec 08 2009 http://d.puremagic.com/issues/show_bug.cgi?id=3600
- d-bugmail puremagic.com (8/8) Dec 08 2009 http://d.puremagic.com/issues/show_bug.cgi?id=3600
- d-bugmail puremagic.com (32/32) Dec 29 2009 http://d.puremagic.com/issues/show_bug.cgi?id=3600
- d-bugmail puremagic.com (9/9) Dec 29 2009 http://d.puremagic.com/issues/show_bug.cgi?id=3600
- d-bugmail puremagic.com (10/10) Jan 18 2010 http://d.puremagic.com/issues/show_bug.cgi?id=3600
- d-bugmail puremagic.com (11/11) Jan 30 2010 http://d.puremagic.com/issues/show_bug.cgi?id=3600
http://d.puremagic.com/issues/show_bug.cgi?id=3600
Summary: template instantiation with empty tuple
Product: D
Version: 2.036
Platform: x86
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P2
Component: DMD
AssignedTo: nobody puremagic.com
ReportedBy: garick_home_333 rambler.ru
---
string func( A... )( string name, string v )
{
return "int " ~ name ~ " = " ~ v ~ ";";
}
void main()
{
writeln( func!( int, long, float )( "val", "10" ) );
writeln( func!()( "tmp", "77" ) ); // D 2.036 successfully compile this,
// but not 2.037
// worked in 2.037
alias func!() TMP;
writeln( TMP( "tmp", "77" ) );
}
2.037 output:
funcmix.d(13): Error: template funcmix.func(A...) does not match any function
template declaration
funcmix.d(13): Error: template funcmix.func(A...) cannot deduce template
function from argument types !()(string,string)
funcmix.d(13): Error: template instance errors instantiating template
May be because '()' and '()' tuples are incompartible ?
see Issue 3278
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 08 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3600
garick <garick_home_333 rambler.ru> changed:
What |Removed |Added
----------------------------------------------------------------------------
Severity|normal |major
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 08 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3600
Rainer Schuetze <r.sagitario gmx.de> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |patch
CC| |r.sagitario gmx.de
PST ---
I don't know why this worked before and could not see a change that caused the
regression from version 2.036, but here is a patch that adds an empty type
tuple to the deduced template parameters if it has not yet been created and
does not show up in the function parameters:
Index: template.c
===================================================================
--- template.c (revision 317)
+++ template.c (working copy)
-1142,6 +1142,13
/* Fill in any missing arguments with their defaults.
*/
+ if(tp && fptupindex < 0 && nargsi == dedargs->dim - 1)
+ { // for variadic type parameters not in function parameters, allow empty
tuple
+ Tuple *t = new Tuple();
+ dedargs->data[dedargs->dim - 1] = (void *)t;
+ nargsi++;
+ }
+
for (i = nargsi; i < dedargs->dim; i++)
{
TemplateParameter *tp = (TemplateParameter *)parameters->data[i];
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 29 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3600
Don <clugdbug yahoo.com.au> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |clugdbug yahoo.com.au
Severity|major |regression
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 29 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3600
Walter Bright <bugzilla digitalmars.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |bugzilla digitalmars.com
01:14:55 PST ---
Changeset 340
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 18 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3600
Walter Bright <bugzilla digitalmars.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
22:45:55 PST ---
fixed dmd 2.040
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 30 2010









d-bugmail puremagic.com 