Re: CTFE toUpper/toLower

2012-08-30 Thread cal
On Thursday, 30 August 2012 at 05:26:52 UTC, Philippe Sigaud wrote: And with no UFCS ? Did you try s ~= toUpper(field) ~ , ; Yeah with or without UFCS, the second one fails.

Re: CTFE toUpper/toLower

2012-08-30 Thread Jacob Carlborg
On 2012-08-30 02:13, cal wrote: Given this code for CTFE on a string array: enum E {one, two} enum string[] fields = [EnumMembers!E].to!(string[]); string print(string[] fields) { string s; foreach(string field; fields) { s ~= field.toUpper ~ , ; } return s; }

Re: CTFE toUpper/toLower

2012-08-30 Thread Jacob Carlborg
On 2012-08-30 08:28, Jacob Carlborg wrote: It works for me. DMD 2.060 Mac OS X. Oh, it does not. If I replace: enum string[] fields = [EnumMembers!E].to!(string[]); With: enum string[] fields = [one, two]; It works. -- /Jacob Carlborg

Re: CTFE toUpper/toLower

2012-08-30 Thread cal
On Thursday, 30 August 2012 at 06:30:50 UTC, Jacob Carlborg wrote: On 2012-08-30 08:28, Jacob Carlborg wrote: It works for me. DMD 2.060 Mac OS X. Oh, it does not. If I replace: enum string[] fields = [EnumMembers!E].to!(string[]); With: enum string[] fields = [one, two]; It works.

Re: CTFE toUpper/toLower

2012-08-30 Thread cal
On Thursday, 30 August 2012 at 17:38:48 UTC, cal wrote: On Thursday, 30 August 2012 at 06:30:50 UTC, Jacob Carlborg wrote: Replacing string[] with dstring[] for EnumMembers triggers a DMD bug, so I guess the CTFE interpreter is buggy even in the string[] case. Filed

CTFE toUpper/toLower

2012-08-29 Thread cal
Given this code for CTFE on a string array: enum E {one, two} enum string[] fields = [EnumMembers!E].to!(string[]); string print(string[] fields) { string s; foreach(string field; fields) { s ~= field.toUpper ~ , ; } return s; } pragma(msg, print([one, two]));

Re: CTFE toUpper/toLower

2012-08-29 Thread Philippe Sigaud
On Thu, Aug 30, 2012 at 2:13 AM, cal callumena...@gmail.com wrote: Given this code for CTFE on a string array: enum E {one, two} enum string[] fields = [EnumMembers!E].to!(string[]); string print(string[] fields) { string s; foreach(string field; fields) { s ~=