I am working on Valum, a web micro-framework written in Vala
https://github.com/antono/valum

valac is generating very strange code that doesn't compile.

Part of the framework is about offering facilities to push arbitrary
values into CTPL template environment.

At some point, I try to case a Value? to a non-null Value (I have of
course tested the null case, I just want it to pass under
--enable-experimental-non-null)

        vala --version
        
        Vala 0.26.1

Here's the use case:

        Value? v;
        var val = (Value) v;

The error:


        lvalue required as unary ‘&’ operand 

I attached the full log and the bug is easily reproducible (the sample
does it).

-- 
Guillaume Poirier-Morency <guillaumepoiriermore...@gmail.com>
test.vala:3.1-1.9: warning: main blocks are experimental
test.vala:3.5-3.19: warning: local variable `val' declared but never used
var val = (Value) v;
    ^^^^^^^^^^^^^^^
In file included from /usr/include/glib-2.0/gobject/gobject.h:24:0,
                 from /usr/include/glib-2.0/gobject/gbinding.h:29,
                 from /usr/include/glib-2.0/glib-object.h:23,
                 from /home/guillaume/test.vala.c:6:
/home/guillaume/test.vala.c: In function ‘_vala_main’:
/home/guillaume/test.vala.c:21:18: erreur: lvalue required as unary ‘&’ operand
  if (G_IS_VALUE (&((GValue) (*_tmp0_)))) {
                  ^
/usr/include/glib-2.0/gobject/gtype.h:1941:58: note: in definition of macro 
‘_G_TYPE_CHV’
 #define _G_TYPE_CHV(vl)   (g_type_check_value ((GValue*) vl))
                                                          ^
/usr/include/glib-2.0/gobject/gvalue.h:50:29: note: in expansion of macro 
‘G_TYPE_CHECK_VALUE’
 #define G_IS_VALUE(value)  (G_TYPE_CHECK_VALUE (value))
                             ^
/home/guillaume/test.vala.c:21:6: note: in expansion of macro ‘G_IS_VALUE’
  if (G_IS_VALUE (&((GValue) (*_tmp0_)))) {
      ^
In file included from /usr/include/glib-2.0/gobject/gobject.h:25:0,
                 from /usr/include/glib-2.0/gobject/gbinding.h:29,
                 from /usr/include/glib-2.0/glib-object.h:23,
                 from /home/guillaume/test.vala.c:6:
/home/guillaume/test.vala.c:22:40: erreur: lvalue required as unary ‘&’ operand
   g_value_init (&_tmp1_, G_VALUE_TYPE (&((GValue) (*_tmp0_))));
                                        ^
/usr/include/glib-2.0/gobject/gvalue.h:59:43: note: in definition of macro 
‘G_VALUE_TYPE’
 #define G_VALUE_TYPE(value)  (((GValue*) (value))->g_type)
                                           ^
/home/guillaume/test.vala.c:23:17: erreur: lvalue required as unary ‘&’ operand
   g_value_copy (&((GValue) (*_tmp0_)), &_tmp1_);
                 ^
error: cc exited with status 256
Compilation failed: 1 error(s), 2 warning(s)

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list

Reply via email to