Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!microsoft!jimad From: jimad@microsoft.UUCP (Jim ADCOCK) Newsgroups: comp.lang.c++ Subject: Re: conditional scope and destrcutors (part 3) Message-ID: <70506@microsoft.UUCP> Date: 6 Feb 91 20:41:17 GMT References: <1991Jan30.124321.17051@hemel.bull.co.uk> Reply-To: jimad@microsoft.UUCP (Jim ADCOCK) Organization: Microsoft Corp., Redmond WA Lines: 38 In article <1991Jan30.124321.17051@hemel.bull.co.uk> pmoore@hemel.bull.co.uk (Paul Moore) writes: |switch(n) |{ | case a: | Class object; | case b: | ...... |} |The general concensus was that this is a programming bug that should be |fatalled by the compiler (cfront does fatal it) - it should certainly |issue a warning - Zortech silently accepts it. (I am sending a copy |of this to ztc-bugs) Illegal -- iff object has an initializer. But, legal switch statements would include: switch(n) { case 1: printf("case 1\n"); default: Class object; } or switch(n) { case 1: { Class object; } case 2: .... } I think it'll take awhile for compilers to get this all sorted out, and it's not yet defined what the constraints are that compilers have to diagnosed in this regard.