GNOME Bugzilla – Bug 85979
template instantiation problem in TreeView::append_column under Sun Forte C++
Last modified: 2004-12-22 21:47:04 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
It's note related to this bug, but could you give us a URL for that SUN bug report?
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.
Have you made any progress on this yourself?
Please respond.
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.
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.
> 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.
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.
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.
I would acccept a patch that added these #ifdefs to the examples/demos.
Created attachment 10209 [details] [review] #ifdefs for Sun Forte C++ (__SUNPRO_CC) to work around it bug in examples