[Bug c++/47950] [C++0x] Internal compiler error: non-dependent declaration as condition causes tsubst_copy_and_build assertion failure.

dev.lists at jessamine dot co.uk gcc-bugzilla@gcc.gnu.org
Wed Mar 2 15:39:00 GMT 2011


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47950

Adam Butcher <dev.lists at jessamine dot co.uk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dev.lists at jessamine dot
                   |                            |co.uk, jason at gcc dot
                   |                            |gnu.org

--- Comment #1 from Adam Butcher <dev.lists at jessamine dot co.uk> 2011-03-02 15:39:00 UTC ---
Added Jason to CC.

Rolling back to my previous HEAD reveals that the reduced example above still
fails whereas the code I was originally trying to build worked.  So obviously
my reduction has changed something.  It doesn't change the fact that there is
an internal compiler error with the example above but it does mean that maybe
it is less likely to be hit.

So I was wrong that the above code has regressed in the last few days.  The
code that I was originally trying to build, which did work a few days ago and
now fails with the symptoms described above was using BOOST_FOREACH.  Obviously
this is unnecessary in C++0x as there is for(:) but it was compiling fine
before (and does in an old GCC 4.5 I have in C++0x mode).

The boost example was a non-dependent boost.foreach in a function template:

  #include <vector>
  #include <boost/foreach.hpp>

  template <typename T>
  void f()
  {
     std::vector<int> v = { 1,2,3,4 };
     BOOST_FOREACH(int x, v)
     {
     }
  }

  int main()
  {
     f<int>();
  }

Making the vector dependent on T rather than int makes the problem go away.  I
arrived at the reduction stated previously by breaking down BOOST_FOREACH until
the failure occurred.

Clearly there is an issue here but I'll do a bit more investigation into why
the boost example worked a few builds ago and why my reduction doesn't.



More information about the Gcc-bugs mailing list