D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 6810 - Strange `tuple used as a type` error
Summary: Strange `tuple used as a type` error
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P2 normal
Assignee: No Owner
URL:
Keywords: pull, rejects-valid
Depends on:
Blocks:
 
Reported: 2011-10-13 02:01 UTC by Denis Shelomovskii
Modified: 2017-07-19 17:39 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Denis Shelomovskii 2011-10-13 02:01:46 UTC
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); }
---
Comment 1 Kasumi Hanazuki 2011-10-26 12:47:11 UTC
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.
Comment 2 Denis Shelomovskii 2011-10-27 02:38:23 UTC
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.
Comment 4 github-bugzilla 2015-02-27 06:34:02 UTC
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/5e897777c763b5f7e854f1a06c50aaa43340b1cb
fix Issue 6810 - Strange `tuple used as a type` error

https://github.com/D-Programming-Language/dmd/commit/6c5e3c378e5c8c23bf51ca94b967ff3e029f2f4f
Merge pull request #4439 from 9rnsr/fix6810

Issue 6810 - Strange `tuple used as a type` error
Comment 6 github-bugzilla 2017-07-19 17:39:01 UTC
Commits pushed to dmd-cxx at https://github.com/dlang/dmd

https://github.com/dlang/dmd/commit/5e897777c763b5f7e854f1a06c50aaa43340b1cb
fix Issue 6810 - Strange `tuple used as a type` error

https://github.com/dlang/dmd/commit/6c5e3c378e5c8c23bf51ca94b967ff3e029f2f4f
Merge pull request #4439 from 9rnsr/fix6810