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

             Bug #: 52458
           Summary: [c++0x] compiler fails on for(:*this) with non-public
                    inheritance with message: Internal compiler error:
                    Error reporting routines re-entered.
    Classification: Unclassified
           Product: gcc
           Version: 4.6.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: criman...@gmail.com


Created attachment 26805
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=26805
preprocessed code

Command line: c++ -std=c++0x -save-temps bug1.cpp
Code:

#include <vector>
/*#include <iostream>*/

#if false
class V : public    std::vector<int>
#else
class V : protected std::vector<int>
#endif
{
public:
  void echo(){for(int x:*this) /*std::cout << ' ' << x */ ;};
};


int main()
{
    V a;
    a.resize(20);
    a.echo();
}

Change false to true in #if directive and code will be compiled succesfully.

Reply via email to