Bug 6852 – Cannot compare instances of ParameterStorageClassTuple

Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2011-10-25T09:43:00Z
Last change time
2013-04-04T22:13:37Z
Assigned to
nobody
Creator
andrej.mitrovich

Comments

Comment #0 by andrej.mitrovich — 2011-10-25T09:43:42Z
import std.traits; void test(T1, T2)(T1 t1, T2 t2) { alias ParameterTypeTuple Types; static assert(is(Types!T1 == Types!T2)); // ok alias ParameterStorageClassTuple Stores; static assert(Stores!(t1) == Stores!(t2)); // NG static assert(Stores!T1 == Stores!T2); // NG static assert(is(Stores!t1 == Stores!t2)); // NG static assert(is(Stores!T1 == Stores!T2)); // NG } void main() { test( (int){}, (int){}); } What gives? ParameterTypeTuple doesn't suffer from these issues. It seems it's impossible to compare equality of storage classes between two functions. :s
Comment #1 by andrej.mitrovich — 2011-10-25T09:47:55Z
Funky workaround: alias Stores!T1 x; alias Stores!T2 y; static assert(x.stringof == y.stringof); Boo!
Comment #2 by k.hara.pg — 2013-04-04T22:13:37Z
(In reply to comment #0) > What gives? ParameterTypeTuple doesn't suffer from these issues. It seems it's > impossible to compare equality of storage classes between two functions. :s ParameterStorageClassTuple makes a tuple of values, so > alias ParameterStorageClassTuple Stores; > > static assert(Stores!(t1) == Stores!(t2)); // NG > static assert(Stores!T1 == Stores!T2); // NG value comparison would work, but > static assert(is(Stores!t1 == Stores!t2)); // NG > static assert(is(Stores!T1 == Stores!T2)); // NG type comparison would not work. From 2.063, value tuple comparison would work by fixing issue 9873.