------- Additional Comments From sebmaestro at hotmail dot com  2005-05-10 
14:37 -------
Subject: RE:  new object affectation in a switch

So, I don't understand why :

  switch (truc) {
  case 0:
    break;
  case 1:
    Thing *th;
    th = new Thing();
    break;
  case 2:
    break;
  case 3:
    break;
  }
is OK for g++.

  switch (truc) {
  case 0:
    break;
  case 1:
    break;
  case 2:
    break;
  case 3:
   Thing *th = new Thing;
    break;
  }

is "correct" too, but

  switch (truc) {
  case 0:
    break;
  case 1:
    Thing *th = new Thing;
    break;
  case 2:
    break;
  case 3:
    break;
  }

is rejected with a french and english (:-D) error message !





>From: "pinskia at gcc dot gnu dot org" <[EMAIL PROTECTED]>
>Reply-To: [EMAIL PROTECTED]
>To: [EMAIL PROTECTED]
>Subject: [Bug c++/21487] new object affectation in a switch
>Date: 10 May 2005 13:12:47 -0000
>
>------- Additional Comments From pinskia at gcc dot gnu dot org  2005-05-10 
>13:12 -------
>This is how C++ works, you can actually fall through case statements.  This 
>is invalid code and G++
>rejects it correctly.
>
>--
>            What    |Removed                     |Added
>----------------------------------------------------------------------------
>              Status|UNCONFIRMED                 |RESOLVED
>          Resolution|                            |INVALID
>
>
>http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21487
>
>------- You are receiving this mail because: -------
>You reported the bug, or are watching the reporter.
>You are on the CC list for the bug, or are watching someone who is.




-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21487

Reply via email to