After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 559278 - Temporary variables in switch condition aren't declared in C code.
Temporary variables in switch condition aren't declared in C code.
Status: RESOLVED FIXED
Product: vala
Classification: Core
Component: Control Flow Statements
0.5.x
Other All
: Normal minor
: ---
Assigned To: Jürg Billeter
Vala maintainers
Depends on:
Blocks:
 
 
Reported: 2008-11-04 14:45 UTC by Levi Bard
Modified: 2008-12-18 00:03 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Levi Bard 2008-11-04 14:45:08 UTC
Please describe the problem:
Temporary variables created in the condition of a switch statement appear not to be getting predeclared in the C code.

Steps to reproduce:
using GLib;

namespace Blah {
	public class Foo: GLib.Object {
		public int blah{ get{ return 1; } }

		public static int main() {

			return 0;
		}// main

		public static void foo() {
			switch(new Foo().blah)
			{
				case 1:
					stdout.printf("Got 1\n");
					break;
				default:
					stdout.printf("Default\n");
					break;
			}
		}
	}// Foo
}// Blah


Actual results:
blah.c: In function ‘blah_foo_foo’:
blah.c:31: error: ‘_tmp1’ undeclared (first use in this function)
blah.c:31: error: (Each undeclared identifier is reported only once
blah.c:31: error: for each function it appears in.)
blah.c:31: error: ‘_tmp0’ undeclared (first use in this function)


Expected results:
Successful compilation.

Does this happen every time?
Yes.

Other information:
Comment 1 Jürg Billeter 2008-12-18 00:03:00 UTC
2008-12-18  Jürg Billeter  <j@bitron.ch>

	* gobject/valaccodecontrolflowmodule.vala:

	Fix temporary variable handling in switch expressions,
	fixes bug 559278

Fixed in r2209.