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 89450 - Impossible casts with Sun Forte C++
Impossible casts with 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-07-30 19:13 UTC by Michael v. Szombathely
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
explicit casts removed in gtk/src/{list,tree}store.cc (1.97 KB, patch)
2002-07-30 22:56 UTC, Michael v. Szombathely
none Details | Review

Description Michael v. Szombathely 2002-07-30 19:13:44 UTC
From the actual CVS gtk/gtkmm/treestore.cc and gtk/gtkmm/liststore.cc give
the following compile errors with Sun Forte C++:

"liststore.cc", line 47: Error: Using static_cast to convert from const
Gtk::TreeRow& to const Gtk::TreeIter& not allowed.
"liststore.cc", line 65: Error: Using static_cast to convert from const
Gtk::TreeRow& to const Gtk::TreeIter& not allowed.
"liststore.cc", line 134: Warning (Anachronism): Assigning
void(*)(void*,void*) to extern "C" void(*)(void*,void*).
2 Error(s) and 1 Warning(s) detected.
make[5]: *** [liststore.lo] Error 1
"treestore.cc", line 46: Error: Using static_cast to convert from const
Gtk::TreeRow& to const Gtk::TreeIter& not allowed.
"treestore.cc", line 64: Error: Using static_cast to convert from const
Gtk::TreeRow& to const Gtk::TreeIter& not allowed.
"treestore.cc", line 156: Warning (Anachronism): Assigning
void(*)(void*,void*) to extern "C" void(*)(void*,void*).

I can solve the problem by using reinterpret_cast, but this might not be
your intention. Please have look into it.
Comment 1 Murray Cumming 2002-07-30 19:48:27 UTC
The first error line is this:

TreeModel::iterator ListStore::insert(const Row& row)
{
  return insert(static_cast<const iterator&>(row));
}

Note that iterator is a typedef for TreeIter, and Row is a typedef for
TreeRow, and that is calling the insert(const iterator& iter) override.

So shouldn't that work even without the static_cast<>, because Row is
an iterator? So maybe you should first try it without any explicit
cast. If that works then please provide a patch.

If that works then maybe the overide isn't needed at all anyway. I'm
not sure whether it's obvious that the other override would work.
Comment 2 Michael v. Szombathely 2002-07-30 20:12:37 UTC
Your assumption was right, the cast are not required at all, with Sun
Forte C++ at least.

I can not see the points in liststore.hg/ccg or treestore.hg/ccg,
where the code came from, so please give me a hint or fixed it by
yourself.
Comment 3 Michael v. Szombathely 2002-07-30 22:56:07 UTC
Created attachment 10129 [details] [review]
explicit
	 casts removed in gtk/src/{list,tree}store.cc
Comment 4 Murray Cumming 2002-07-31 09:35:57 UTC
Thanks. Applied. On the list I will ask people whether they think
these overrides are necessary anyway.

> I can not see the points in liststore.hg/ccg or treestore.hg/ccg,
> where the code came from, so please give me a hint or fixed it by
> yourself.

I don't understand what you mean here. You just fixed it in the .ccg
files. Do you mean some other problem?
Comment 5 Michael v. Szombathely 2002-07-31 10:42:19 UTC
> I don't understand what you mean here. You just fixed it 
> in the .ccg files. Do you mean some other problem?

No, I had just overlooked the simple solution here.