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 652781 - nullable enum does not work properly
nullable enum does not work properly
Status: RESOLVED FIXED
Product: vala
Classification: Core
Component: Code Generator
0.12.x
Other Linux
: Normal normal
: ---
Assigned To: Vala maintainers
Vala maintainers
Depends on:
Blocks:
 
 
Reported: 2011-06-16 21:12 UTC by Jan Spurny
Modified: 2011-06-17 19:14 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Jan Spurny 2011-06-16 21:12:39 UTC
When enum variable is marked as nullable by "?", it stops working.
Here is a small piece of code demonstrating the problem:

enum MyEnum { ONE, TWO }
int main(string[] args)
{
    MyEnum a = MyEnum.ONE;
    if (a == MyEnum.ONE)
        stdout.printf("a is one\n");

    MyEnum? b = MyEnum.ONE;
    if (b == MyEnum.ONE)
        stdout.printf("b is one\n");
    return 0;
}

It should print:
a is one
b is one

but it prints only the first line instead.

If "MyEnum? b" is replaced by "MyEnum b" everything works.
Comment 1 Luca Bruno 2011-06-17 19:14:39 UTC
commit 93916205264b4e90842f57675fb455c69a94fa8d
Author: Luca Bruno <lucabru@src.gnome.org>
Date:   Fri Jun 17 15:38:00 2011 +0200

    codegen: Fix equality expression with nullable enum values
    
    Fixes bug 652781.

This problem has been fixed in the development version. The fix will be available in the next major software release. Thank you for your bug report.