]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
codegen: Do not try to unbox a GValue from a GValue
authorLuca Bruno <lucabru@src.gnome.org>
Fri, 2 Sep 2011 12:02:36 +0000 (14:02 +0200)
committerLuca Bruno <lucabru@src.gnome.org>
Fri, 2 Sep 2011 12:07:11 +0000 (14:07 +0200)
Fixes bug 658048.

codegen/valaccodebasemodule.vala
tests/Makefile.am
tests/structs/bug658048.vala [new file with mode: 0644]

index 76fc9d6f826fe2842daf13f07ebda1682dd2a88a..5b66896133e0534348ec7f07ed63310d46f31526 100644 (file)
@@ -4462,7 +4462,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
        }
 
        public CCodeExpression? try_cast_value_to_type (CCodeExpression ccodeexpr, DataType from, DataType to, Expression? expr = null) {
-               if (from == null || gvalue_type == null || from.data_type != gvalue_type || get_ccode_type_id (to) == "") {
+               if (from == null || gvalue_type == null || from.data_type != gvalue_type || to.data_type == gvalue_type || get_ccode_type_id (to) == "") {
                        return null;
                }
 
index d1b1491f9bf6f45976717042c8d2fe842e59f1c7..751766d3146d196e24ebd204c3a7fd25b130de94 100644 (file)
@@ -73,6 +73,7 @@ TESTS = \
        structs/bug654646.vala \
        structs/bug654753.vala \
        structs/bug656693.vala \
+       structs/bug658048.vala \
        delegates/delegates.vala \
        delegates/bug539166.vala \
        delegates/bug595610.vala \
diff --git a/tests/structs/bug658048.vala b/tests/structs/bug658048.vala
new file mode 100644 (file)
index 0000000..dda3b0e
--- /dev/null
@@ -0,0 +1,4 @@
+void main () {
+       Value a = 10;
+       bool res = a == a;
+}