source/protocols.d(40, 34): Error: uninitialized variable 'value' cannot be returned from CTFE

Stefan via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon May 16 04:31:53 PDT 2016


On Monday, 16 May 2016 at 11:13:52 UTC, ag0aep6g wrote:
> On 05/16/2016 11:24 AM, Stefan wrote:
>> source/protocols.d(40,34): Error: uninitialized variable 
>> 'value' cannot
>> be returned from CTFE
>
> Ouch. That's not a good error message. There is no `value` on 
> that line.
>
> I've filed an issue: 
> https://issues.dlang.org/show_bug.cgi?id=16030
> ----

thank you

> Protocol[] Protocols;
>
> static this()
> {
>     Protocols = [
>         Protocol(P_IP4, 32, "ip4", CodeToVarint(P_IP4)),
>         Protocol(P_TCP, 16, "tcp", CodeToVarint(P_TCP)),
>         Protocol(P_UDP, 16, "udp", CodeToVarint(P_UDP)),
>         Protocol(P_DCCP, 16, "dccp", CodeToVarint(P_DCCP)),
>         Protocol(P_IP6, 128, "ip6", CodeToVarint(P_IP6)),
>             // these require varint:
>         Protocol(P_SCTP, 16, "sctp", CodeToVarint(P_SCTP)),
>         Protocol(P_ONION, 80, "onion", CodeToVarint(P_ONION)),
>         Protocol(P_UTP, 0, "utp", CodeToVarint(P_UTP)),
>         Protocol(P_UDT, 0, "udt", CodeToVarint(P_UDT)),
>         Protocol(P_HTTP, 0, "http", CodeToVarint(P_HTTP)),
>         Protocol(P_HTTPS, 0, "https", CodeToVarint(P_HTTPS)),
>         Protocol(P_IPFS, LengthPrefixedVarSize, "ipfs", 
> CodeToVarint(P_IPFS)),
>     ];
> }
> ----
>

forgot about "static this", works like a charm



More information about the Digitalmars-d-learn mailing list