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 131928 - G++-3.4 prerelease: Broken template method in Gtk::TreePath.
G++-3.4 prerelease: Broken template method in Gtk::TreePath.
Status: RESOLVED FIXED
Product: gtkmm
Classification: Bindings
Component: TreeView
2.4
Other All
: Normal major
: ---
Assigned To: gtkmm-forge
gtkmm-forge
Depends on:
Blocks:
 
 
Reported: 2004-01-19 15:10 UTC by Matthew Tuck
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Matthew Tuck 2004-01-19 15:10:48 UTC
This code is in treepath.hg:

template <class In>
void TreePath::append(In pbegin, In pend)
{
  // push_back() can't throw -- if it could, this code wouldn't be strongly
exception-safe.
  for(; pbegin != pend; ++pbegin)
    this->push_back(*begin);
}

Prerelease G++-3.4 complains about this code, whereas G++-3.2 doesn't. 
This is presumably due to the new two-stage lookup rules, where I presume
some names are resolved before instantiation time.

The problem is "begin" needs to be "pbegin".

This would have broken in G++-3.2, but I guess no one ever instantiated
this method, the following code shows it is broken either way:

#include <gtkmm.h>
#include <list>

int main() {

  Gtk::TreePath path;
  std::list< int > a;
  
  a.push_back( 1 );
  path.append( a.begin(), a.end() );
}
Comment 1 Murray Cumming 2004-01-20 09:42:25 UTC
I don't really understand why the this-> is necessary, but I would
happily apply a patch with a ChangeLog entry and a comment next to the
line so that the this-> is not accidentally removed again later.
Comment 2 Matthew Tuck 2004-01-20 15:35:45 UTC
It's necessary because the standard requires it.  I think it happens
when you have a template inheriting from a template, where you need to
use this to access supermethods.

I thought I saw this a fair bit already in GTKMM, and even if it isn't
it will be in a fair few places in the near future, because it is
required.  I don't think a comment in each place is feasible.
Comment 3 Murray Cumming 2004-01-20 18:38:55 UTC
A comment will do no harm.
Comment 4 Murray Cumming 2004-01-28 12:48:26 UTC
By the way, this is mentioned in the gcc ChangeLog:
http://gcc.gnu.org/gcc-3.4/changes.html
Comment 5 Murray Cumming 2004-01-29 22:15:48 UTC
This should be easy to make a patch for.
Comment 6 Julian Missig 2004-02-11 19:36:47 UTC
Just to be clear... you want someone to write up a ChangeLog entry, add a single character 
to a source file, make a patch out of that, submit it to you, and then you'll look over this 
single character addition, apply the patch, and put it in?
Comment 7 Murray Cumming 2004-02-13 18:32:27 UTC
And _test_ it with the _compiler_ that they have. My time is limited,
even for easy stuff.
Comment 8 Murray Cumming 2004-02-13 18:33:24 UTC
And it's not a single character, and probably not a single line.
Comment 9 Murray Cumming 2004-02-26 23:27:32 UTC
Ah, I see that I completely misunderstood this bug when speed reading
it originally. Patches really are easier, you see.

The change has been committed. Thanks.

By the way, I have no idea why this method is a template.