/* When compiled with:
 * clang ./clang.c $(pkg-config --cflags --libs gobject-2.0)
 * (clang version 2.8 (branches/release_28))
 *
 *
 * ./clang.c:30:1: warning: incompatible pointer types initializing 'GType
 *      (*)(gchar const *, union <anonymous at ./clang.c:30:1>, union <anonymous
 *      at ./clang.c:30:1>)' with an expression of type 'GType (gchar const *,
 *      GBoxedCopyFunc, GBoxedFreeFunc)'
 * G_DEFINE_BOXED_TYPE(BoxedString, boxed_string,
 * ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 * In file included from ./clang.c:5:
 * In file included from /usr/include/glib-2.0/glib-object.h:25:
 * In file included from /usr/include/glib-2.0/gobject/gbinding.h:31:
 * In file included from /usr/include/glib-2.0/gobject/gobject.h:26:
 * /usr/include/glib-2.0/gobject/gtype.h:1521:72: note: instantiated from:
 *   ...copy_func, free_func) G_DEFINE_BOXED_TYPE_WITH_CODE (TypeName, ...
 *                          ^
 * /usr/include/glib-2.0/gobject/gtype.h:1538:87: note: instantiated from:
 *   ...free_func, _C_) _G_DEFINE_BOXED_TYPE_BEGIN (TypeName, type_name, ...
 *                    ^
 * /usr/include/glib-2.0/gobject/gtype.h:1548:16: note: instantiated from:
 *       GType (* _g_register_boxed) \
 *
 * 1 warning generated.
 */

#include <glib-object.h>
#include <stdio.h>

typedef struct {
    gchar *str;
} BoxedString;

static BoxedString *
boxed_string_copy(const BoxedString *from)
{
    BoxedString *str;

    str = g_new0(BoxedString, 1);
    str->str = g_strdup(from->str);

    return str;
}

static void
boxed_string_free(BoxedString *str)
{
    g_free(str->str);
    g_free(str);
}

G_DEFINE_BOXED_TYPE(BoxedString, boxed_string,
                   (GBoxedCopyFunc)boxed_string_copy,
                   (GBoxedFreeFunc)boxed_string_free);

int main (int argc, char **argv)
{
    printf("__GNUC__: %d __GNUC_MINOR__: %d\n", __GNUC__, __GNUC_MINOR__);
    g_type_init();

    return 0;
}
