Re: A problem with const

2011-07-14 Thread Daniel Murphy
I don't think there's a bug report specifically on this. "bearophile" wrote in message news:ivmigl$98a$1...@digitalmars.com... > Daniel Murphy: > >> Yeah, type deduction with modifiers is inconsistent. >> >> In some cases matching T to const(U) gives U == tailconst(T), but not in >> others. >> T

Re: A problem with const

2011-07-14 Thread bearophile
Daniel Murphy: > Yeah, type deduction with modifiers is inconsistent. > > In some cases matching T to const(U) gives U == tailconst(T), but not in > others. > The problem exists with pointers, arrays, and (if we ever get it) Michel > Fortin's const(Object)ref. Is this already in Bugzilla, or d

Re: A problem with const

2011-07-14 Thread Daniel Murphy
Yeah, type deduction with modifiers is inconsistent. In some cases matching T to const(U) gives U == tailconst(T), but not in others. The problem exists with pointers, arrays, and (if we ever get it) Michel Fortin's const(Object)ref. A big part of the problem is that it can match with implicit

A problem with const

2011-07-14 Thread bearophile
A D2 program: T[] foo(T)(const T[] x) { //static assert(is(U == int)); // false static assert(is(T == const(int))); return new T[1]; } U[] bar(U)(const U[] y) { static assert(is(U == int)); return foo(y); } void main() { bar([1]); } DMD 2.054 gives: test.d(8): Error: can