This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/21487] new object affectation in a switch
- From: "sebmaestro at hotmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 10 May 2005 14:37:05 -0000
- Subject: [Bug c++/21487] new object affectation in a switch
- References: <20050510123300.21487.sebmaestro@hotmail.com>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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" <gcc-bugzilla@gcc.gnu.org>
>Reply-To: gcc-bugzilla@gcc.gnu.org
>To: sebmaestro@hotmail.com
>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