goto case warning

J Arrizza cppgent0 at gmail.com
Sat Nov 12 21:12:25 PST 2011


I'm getting an odd error message in line 366 below (this is part of
variant.d):

../utd/variant.d(366): Error: switch case fallthrough - use 'goto case;' if
intended


But you can see that line 366 already has a "goto case":

            switch(id) {
                foreach(i,T; ICT!A ) {
                    static if (is(typeof(*cast(T*) ptr = *src)) ) {
                        //@@@@BUG@@@@ workaround the string <=>
immutable(char)[] problem
                        static if((is(T : const(char[])) || is(T :
const(wchar[])) || is(T : const(dchar[]))) &&
                                  T.stringof !=
(typeof(T.init[0])).stringof~"[]" ) {
                            case (typeof(T.init[0])).stringof~"[]": goto
case;
                        }

                        // isImplicitlyConvertible!(T,immutable T) [inlined]
                        static if( !is(immutable T == T)  &&
is(typeof({void fun(immutable(T)){} T f; fun(f);}())) ) {
                            case (immutable T).stringof: goto case;
                        }

                        static if(!is(const(T) == T) &&
!(i==1&&is(typeof(T.init[]))) ) {
                            case (const     T).stringof: goto case;  //@@@@
THIS IS LINE 366
                        }
                            case (          T).stringof:
                                static if(is(T:Object)) {
                                    if(info !is typeid(T) && info !is
typeid(const T) && info !is typeid(immutable T) )
                                        continue;
                                }
                                if (src && ptr)
                                    *(cast(T*) ptr) = *src;
                                return true;
                    }
                }

Any help is appreciated, thanks
John
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20111112/d0f9e78d/attachment.html>


More information about the Digitalmars-d mailing list