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 85979 - template instantiation problem in TreeView::append_column under Sun Forte C++
template instantiation problem in TreeView::append_column under Sun Forte C++
Status: RESOLVED FIXED
Product: gtkmm
Classification: Bindings
Component: build
2.0
Other Solaris
: Normal normal
: ---
Assigned To: gtkmm-forge
gtkmm-forge
Depends on:
Blocks:
 
 
Reported: 2002-06-19 21:19 UTC by Michael v. Szombathely
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
#ifdefs for Sun Forte C++ (__SUNPRO_CC) to work around it bug in examples (4.26 KB, patch)
2002-08-02 09:30 UTC, Michael v. Szombathely
none Details | Review

Description Michael v. Szombathely 2002-06-19 21:19:39 UTC
Hi,

we are face with a strange compilation problem when using
TreeView::append_column (e.g. examples/paned/paned.cc).

> CC -DHAVE_CONFIG_H -I. ... -verbose=template -c paned.cc
"../../gtk/gtkmm/treedragsource.h", line 95: Warning: extra ";" ignored.
"../../glib/glibmm/refptr.h", line 142: Information: Instantiating
Glib::RefPtr<Gtk::ListStore>::clear().
"paned.cc", line 45: Information: Instantiating
Glib::RefPtr<Gtk::TreeModel>::RefPtr<Gtk::ListStore>(const
Glib::RefPtr<Gtk::ListStore>&).
"../../gtk/gtkmm/treeiter.h", line 272: Information: Instantiating
Gtk::TreeRow::set_value<Glib::ustring>(const
Gtk::TreeModelColumn<Glib::ustring>&, const Glib::ustring&) const.
"../../gtk/gtkmm/treeview.h", line 699: Information: Instantiating
Gtk::TreeViewColumn::TreeViewColumn<Glib::ustring>(const Glib::ustring&,
const Gtk::TreeModelColumn<Glib::ustring>&).
Error: The operation "* const Glib::ustring" is illegal.
"../../gtk/gtkmm/treeview.h", line 699:     Where: While instantiating
"Gtk::TreeViewColumn::TreeViewColumn<Glib::ustring>(const Glib::ustring&,
const Gtk::TreeModelColumn<Glib::ustring>&)".
"../../gtk/gtkmm/treeview.h", line 699:     Where: Instantiated from
non-template code.
Error: Cannot use int to initialize char*.
"../../gtk/gtkmm/treeview.h", line 699:     Where: While instantiating
"Gtk::TreeViewColumn::TreeViewColumn<Glib::ustring>(const Glib::ustring&,
const Gtk::TreeModelColumn<Glib::ustring>&)".
"../../gtk/gtkmm/treeview.h", line 699:     Where: Instantiated from
non-template code.
Error: The operation "const Glib::ustring[unsigned]" is illegal.
"../../gtk/gtkmm/treeview.h", line 699:     Where: While instantiating
"Gtk::TreeViewColumn::TreeViewColumn<Glib::ustring>(const Glib::ustring&,
const Gtk::TreeModelColumn<Glib::ustring>&)".
"../../gtk/gtkmm/treeview.h", line 699:     Where: Instantiated from
non-template code.
Error: Cannot use int to initialize char*.
"../../gtk/gtkmm/treeview.h", line 699:     Where: While instantiating
"Gtk::TreeViewColumn::TreeViewColumn<Glib::ustring>(const Glib::ustring&,
const Gtk::TreeModelColumn<Glib::ustring>&)".
"../../gtk/gtkmm/treeview.h", line 699:     Where: Instantiated from
non-template code.
Error: The operation "* const Glib::ustring" is illegal.
"../../gtk/gtkmm/treeview.h", line 699:     Where: While instantiating
"Gtk::TreeViewColumn::TreeViewColumn<Glib::ustring>(const Glib::ustring&,
const Gtk::TreeModelColumn<Glib::ustring>&)".
"../../gtk/gtkmm/treeview.h", line 699:     Where: Instantiated from
non-template code.
Error: Cannot use int to initialize char*.
"../../gtk/gtkmm/treeview.h", line 699:     Where: While instantiating
"Gtk::TreeViewColumn::TreeViewColumn<Glib::ustring>(const Glib::ustring&,
const Gtk::TreeModelColumn<Glib::ustring>&)".
"../../gtk/gtkmm/treeview.h", line 699:     Where: Instantiated from
non-template code.
Error: Cannot use int to initialize __mptr*.
"../../gtk/gtkmm/treeview.h", line 699:     Where: While instantiating
"Gtk::TreeViewColumn::TreeViewColumn<Glib::ustring>(const Glib::ustring&,
const Gtk::TreeModelColumn<Glib::ustring>&)".
"../../gtk/gtkmm/treeview.h", line 699:     Where: Instantiated from
non-template code.
Error: Cannot use int to initialize __mptr*.
"../../gtk/gtkmm/treeview.h", line 699:     Where: While instantiating
"Gtk::TreeViewColumn::TreeViewColumn<Glib::ustring>(const Glib::ustring&,
const Gtk::TreeModelColumn<Glib::ustring>&)".
"../../gtk/gtkmm/treeview.h", line 699:     Where: Instantiated from
non-template code.
Error: Cannot continue processing because of prior errors.
"../../gtk/gtkmm/treeview.h", line 699:     Where: While instantiating
"Gtk::TreeViewColumn::TreeViewColumn<Glib::ustring>(const Glib::ustring&,
const Gtk::TreeModelColumn<Glib::ustring>&)".
"../../gtk/gtkmm/treeview.h", line 699:     Where: Instantiated from
non-template code.

The source paned.cc is getting compiled. The error occur during the
automatic internal compilation of the template instatiation stubs.
Obviously the compiler can not intatiate 

  Gtk::TreeViewColumn::TreeViewColumn<Glib::ustring>
    (const Glib::ustring&, const Gtk::TreeModelColumn<Glib::ustring>&)

inside of

  TreeView::append_column(const Glib::ustring& title, 
                          const TreeModelColumn<ColumnType>& model_column)

in gtk/gtkmm/treeview.h

The error messages around Glib::ustring are hardly understandable. Thus
it's not clear for us, whether the compiler is buggy here or not.

Any ideas about this?


BTW: Sun has finally recognized the inability of Sun Forte C++ to called 
enum operator overloads as a compiler bug. The bug id is 4680941, but we
are still waiting for the fix :-(

Regards Michael
Comment 1 Murray Cumming 2002-06-20 13:09:06 UTC
It's note related to this bug, but could you give us a URL for that 
SUN bug report?
Comment 2 Michael v. Szombathely 2002-06-20 20:01:17 UTC
The bug reports are not accessible for people outside from Sun, me
too. I got the informatation from Rose Lee during my last thread to
the enum operator overload problem. Just have look to
http://forum.sun.com/thread.jsp?forum=5&thread=8994.
Comment 3 Murray Cumming 2002-07-11 08:19:28 UTC
Have you made any progress on this yourself?
Comment 4 Murray Cumming 2002-07-26 15:30:43 UTC
Please respond.
Comment 5 Michael v. Szombathely 2002-07-30 19:07:00 UTC
We have finally traced down the problem to a bug in the Sun Forte
compiler (see http://forum.sun.com/thread.jsp?forum=5&thread=9833).
Basically all versions of the Sun Forte C++ compiler show up this
capital bug, failing to compile anything, when virtual inheritance is
used in combination with template parameters. As we have a support
contract I'm now in contact with the Sun Service in order to push them
to fix this bug rather soon. And they promise already to do so, as it
happens with their new compiler line (Sun ONE compiler suite, not
available yet) too.

In contradiction to all other porting problems we had before there
seems to be no simple way to overcome this one by patching without
changing the current API. Luckily the only case where we find this
breaking situaion is

  int TreeView::append_column(const Glib::ustring& title, 
                              const TreeModelColumn<ColumnType>&
model_column).

Unfortunately this makes list boxes unusable with Forte C++ as we can
not fill them. For a while we switched to g++ (now version 3.1.1)
under Sun Solaris, but to get Gtk-- into production code we need it
working with the Sun C++ compiler again. At the moment we are thinking
about an API addition of TreeView::append_column for the Sun Compiler,
e.g. specialization for strings as column type, in order to work
around this bug as long Sun has not provided a fix for their compiler.
Comment 6 Murray Cumming 2002-07-30 19:54:53 UTC
Excellent research. It would be great if Sun fix this, but it needs to
be in weeks, not months. Shouldn't that URL show some official "Yes,
it's our fault" response from Sun?

If you cannot use the append_column() template then you should do what
the append_column() code does manually, using specific types. That's
what GTK+ people must do.

The gtkmm book's TreeView chapter shows how to append columns without
using that append_column() method, for instance, when you don't want
default CellRenderers, or if you want more than one model column in a
view column. Please tell me if this is not an acceptable solution.
Comment 7 Michael v. Szombathely 2002-07-30 22:31:39 UTC
> It would be great if Sun fix this, but it needs to be in weeks, 
> not months. Shouldn't that URL show some official "Yes, it's our
> fault" response from Sun?

It should, but that is not the way it works with the commercial
compiler vendors. My wish to use the Sun Forte forum as a channel to
their compiler developers was simply not fullfilled, but the ongoing
reactions to my bug reports from the Sun Service give me some hope.
Comment 8 Murray Cumming 2002-07-31 10:24:10 UTC
OK, if you can add columns without that particular method, as
described, then I'll close this as not-a-bug, and add a comment to the
documentation.
Comment 9 Michael v. Szombathely 2002-08-01 09:19:01 UTC
We work around the compiler bug now this way:

#ifdef __SUNPRO_CC
    // Sun Forte C++ compiler can not handle template constructors
    Gtk::TreeViewColumn c;
    c.set_title(title);
    c.pack_start(model);
#else
    Gtk::TreeViewColumn c(title, model);
#endif
    treeView.append_column(c);


This will work for time Sun needs to fix their compiler bug, thus you
can close it as not-a-bug in gtkmm.
Comment 10 Murray Cumming 2002-08-01 19:40:50 UTC
I would acccept a patch that added these #ifdefs to the examples/demos.
Comment 11 Michael v. Szombathely 2002-08-02 09:30:37 UTC
Created attachment 10209 [details] [review]
#ifdefs for Sun Forte C++ (__SUNPRO_CC) to work around it bug in examples