method has no return statement with switch

BBaz via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Nov 6 17:02:41 PST 2015


On Saturday, 7 November 2015 at 00:30:29 UTC, crimaniak wrote:
> On Saturday, 7 November 2015 at 00:27:02 UTC, Adam D. Ruppe 
> wrote:
>> On Saturday, 7 November 2015 at 00:21:57 UTC, crimaniak wrote:
>>> Inserting dummy return statement doesn't help. final switch / 
>>> switch with default - no matter.
>>
>>
>> Try inserting assert(0); instead of a dummy return.
>
>  Done, no difference.

Wow, that impossible. You switch is well final.

here DMD 2.068, linux x86_64 the folling compiles and runs:

----
enum Method { GET="GET", POST="POST" }

class UrlCache
{
	public string doRealRequest(string url, Method method)
	{
		final switch(method)
		{
			case Method.GET:
				return std.net.curl.get!AutoProtocol(url).idup;
			case Method.POST:
				return std.net.curl.post(url, []).idup;
		}
     }
}

void main()
{auto test = new UrlCache;}
----

are you sure that the error you get doesnt come from another 
location ?!


More information about the Digitalmars-d-learn mailing list