digitalmars.D.bugs - [Issue 3278] New: Empty tuples don't match
- d-bugmail puremagic.com (26/26) Sep 01 2009 http://d.puremagic.com/issues/show_bug.cgi?id=3278
- d-bugmail puremagic.com (34/34) Oct 11 2010 http://d.puremagic.com/issues/show_bug.cgi?id=3278
- d-bugmail puremagic.com (12/12) Oct 11 2010 http://d.puremagic.com/issues/show_bug.cgi?id=3278
http://d.puremagic.com/issues/show_bug.cgi?id=3278
Summary: Empty tuples don't match
Product: D
Version: 2.032
Platform: Other
OS/Version: Windows
Status: NEW
Severity: critical
Priority: P2
Component: DMD
AssignedTo: nobody puremagic.com
ReportedBy: bartosz relisoft.com
A tuple containing an empty tuple is not the same as an empty tuple and two
such beasts are considered incompatible.
----
import std.typetuple;
template TypeList(T...)
{
alias T toTuple;
}
static assert (TypeList!().toTuple == TypeTuple!());
----
Error: incompatible types for ((()) == (())): '()' and '()'
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 01 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3278
Manuel König <manuelk89 gmx.net> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |manuelk89 gmx.net
OS/Version|Windows |All
Severity|critical |normal
Reduced testcase:
template TypeTuple(TList...)
{
alias TList TypeTuple;
}
template TypeList(T...)
{
alias T toTuple;
}
static assert (TypeList!().toTuple == TypeTuple!());
Actually dmd is right to reject the code, but it's bad at conveying the reason.
You're trying to compare types with a '==' expression directly, which is not
allowed. Use is(A==B), instead, where A,B are types (documented), or
type-tuples (I think that it works for type-tuples is undocumented, but
type-tuples are treated like types in the frontend). These asserts compile and
the tests pass:
static assert (is(TypeList!().toTuple == TypeTuple!()));
static assert (is(TypeList!(int).toTuple == TypeTuple!(int)));
You can see it has nothing to do with empty tuples being a special case or so.
But I would like dmd to produce an error message like this:
Error: can not compare types with '==', use is(TypeA==TypeB) instead
I changed importance to normal, because it's just a bad error message. I see
you have wrong-code in the keywords list, so maybe you knew that already?
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 11 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3278
Manuel König <manuelk89 gmx.net> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords|wrong-code |diagnostic
Status|NEW |RESOLVED
Resolution| |DUPLICATE
*** This issue has been marked as a duplicate of issue 3279 ***
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 11 2010









d-bugmail puremagic.com 