Thread overview
[Issue 6810] New: Strange `tuple used as a type` error
Oct 13, 2011
Denis
Oct 26, 2011
Kasumi Hanazuki
Oct 27, 2011
Denis
October 13, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6810

           Summary: Strange `tuple used as a type` error
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: verylonglogin.reg@gmail.com


--- Comment #0 from Denis <verylonglogin.reg@gmail.com> 2011-10-13 02:01:46 PDT ---
Strange `tuple used as a type` error if using: template tuple parameter + named argument of its type + an constraint.
---
void f(int n)(int) { }
void f(U...)(U)    { } // ok
void f(U...)(U a)  { } // ok
void f(U...)(U)   if(true) { } // ok
void f(U...)(U a) if(true) { } // Error: tuple U is used as a type

void main() { f!0(0); }
---

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 26, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6810


Kasumi Hanazuki <k.hanazuki@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |k.hanazuki@gmail.com


--- Comment #1 from Kasumi Hanazuki <k.hanazuki@gmail.com> 2011-10-26 12:47:11 PDT ---
Isn't this the correct behavior? -- U = 0 is not an type.

By the precedence of overload resolution, DMD does not instantiate some of the
template function overloads and semantic errors are not reported for them.
If you define each template function alone, DMD(v2.056head) reports a "used as
a type" error for it.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 27, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6810



--- Comment #2 from Denis <verylonglogin.reg@gmail.com> 2011-10-27 13:38:23 MSD ---
dmd 2.056 now prints same error for both tuple templates with an constraint (so
this bug is at least more consistent now).
P.S.
This is the full test code, I don't propose to define any function alone.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------