[Issue 9828] New: Inconsistent lowering of 1-element tuple to its element
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Mar 29 08:54:28 PDT 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9828
Summary: Inconsistent lowering of 1-element tuple to its
element
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: P2
Component: druntime
AssignedTo: nobody at puremagic.com
ReportedBy: andrej.mitrovich at gmail.com
--- Comment #0 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2013-03-29 08:54:26 PDT ---
template tuple(T...) { alias tuple = T; }
template get(alias sym)
{
alias get = sym;
}
void main()
{
alias tuple!(int, float) IntFloat;
// alias a = get!IntFloat; // does not match, OK
alias tuple!(int) Int;
// alias b = get!Int; // does not match, OK
alias tuple!("foo", "bar") FooBar;
// alias c = get!FooBar; // does not match, OK
alias tuple!("foo") Foo;
alias d = get!Foo; // works, ??
if (d == "foo") { } // works
if (Foo == "foo") { } // does not work
}
It's really strange that a 1-element tuple seems to be implicitly convertible
to its element type when it's passed by alias, yet we cannot directly compare a
1-element tuple against another element of the same type.
Either it should be consistently allowed to use a 1-element tuple as if it were
the element itself, or it should never be implicitly convertible to the element
type. It should be consistent.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list