pragma(msg,

Ellery Newcomer ellery-newcomer at utulsa.edu
Sun Jan 30 10:15:03 PST 2011


On 01/30/2011 07:40 AM, Philippe Sigaud wrote:
> On Sun, Jan 30, 2011 at 00:26, Ellery Newcomer
> <ellery-newcomer at utulsa.edu>  wrote:
>> code:
>>
>> template tct(T1,T2){
>>     string tct = T1.stringof ~ " " ~ T2.stringof ~
>>         typeof(true?T1.init:T2.init).stringof;
>> }
>> pragma(msg, tct!(shared(const(int))*, const(int*)));
>>
>> result:
>>
>> tct
>>
>>
>> why?
>
> Because the inner string is not a CT constant. Put an 'enum' before.
>
> Philippe

doh.

when I did something like

enum string s = tct!(int,int);

it just took it and didn't complain that it didn't know the value at 
compile time.


More information about the Digitalmars-d-learn mailing list