[Issue 5980] foreach element of a type tuple of string literals is not implicitly convertible to immutable(char)*

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed May 11 12:36:42 PDT 2011


http://d.puremagic.com/issues/show_bug.cgi?id=5980


kennytm at gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Can't pass __traits value   |foreach element of a type
                   |as const(char)*             |tuple of string literals is
                   |                            |not implicitly convertible
                   |                            |to immutable(char)*


--- Comment #5 from kennytm at gmail.com 2011-05-11 12:32:41 PDT ---
Actually it's a problem in foreach-ing a TupleExp of StringExp, not __traits. I
changed the title to reflect that.

-------------------------------------
template TypeTuple(T...) {
    alias T TypeTuple;
}
void main() {
    alias TypeTuple!"1" T;
    usefield(T[0]);     // ok
    foreach (j; T)
        usefield(j);    // error on 2.053
}
void usefield(const(char)* foo) {
}
-------------------------------------

(Still, I think it's better to use .ptr then relying on it the implicit string
literal -> pointer conversion.)

-- 
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