public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/52458] New: [c++0x] compiler fails on for(:*this) with non-public inheritance with message: Internal compiler error: Error reporting routines re-entered.
@ 2012-03-02  2:17 crimaniak at gmail dot com
  2012-03-02  2:19 ` [Bug c++/52458] " crimaniak at gmail dot com
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: crimaniak at gmail dot com @ 2012-03-02  2:17 UTC (permalink / raw)
  To: gcc-bugs

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: unassigned@gcc.gnu.org
        ReportedBy: crimaniak@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.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c++/52458] [c++0x] compiler fails on for(:*this) with non-public inheritance with message: Internal compiler error: Error reporting routines re-entered.
  2012-03-02  2:17 [Bug c++/52458] New: [c++0x] compiler fails on for(:*this) with non-public inheritance with message: Internal compiler error: Error reporting routines re-entered crimaniak at gmail dot com
@ 2012-03-02  2:19 ` crimaniak at gmail dot com
  2012-03-02  9:36 ` redi at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: crimaniak at gmail dot com @ 2012-03-02  2:19 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Alexey Kulentsov <crimaniak at gmail dot com> 2012-03-02 02:19:02 UTC ---
Created attachment 26806
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=26806
-v compiler output


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c++/52458] [c++0x] compiler fails on for(:*this) with non-public inheritance with message: Internal compiler error: Error reporting routines re-entered.
  2012-03-02  2:17 [Bug c++/52458] New: [c++0x] compiler fails on for(:*this) with non-public inheritance with message: Internal compiler error: Error reporting routines re-entered crimaniak at gmail dot com
  2012-03-02  2:19 ` [Bug c++/52458] " crimaniak at gmail dot com
@ 2012-03-02  9:36 ` redi at gcc dot gnu.org
  2012-03-02 10:35 ` redi at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2012-03-02  9:36 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2012-03-02
      Known to work|                            |4.7.0
     Ever Confirmed|0                           |1

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-03-02 09:36:09 UTC ---
trunk gives:

l.cc:18:16: error: ‘std::vector<int>’ is not an accessible base of ‘V’

which is better than ICE but still wrong, I think


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c++/52458] [c++0x] compiler fails on for(:*this) with non-public inheritance with message: Internal compiler error: Error reporting routines re-entered.
  2012-03-02  2:17 [Bug c++/52458] New: [c++0x] compiler fails on for(:*this) with non-public inheritance with message: Internal compiler error: Error reporting routines re-entered crimaniak at gmail dot com
  2012-03-02  2:19 ` [Bug c++/52458] " crimaniak at gmail dot com
  2012-03-02  9:36 ` redi at gcc dot gnu.org
@ 2012-03-02 10:35 ` redi at gcc dot gnu.org
  2012-03-02 12:39 ` redi at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2012-03-02 10:35 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-valid-code
      Known to fail|                            |4.6.2

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-03-02 10:34:56 UTC ---
(In reply to comment #2)
> trunk gives:
> 
> l.cc:18:16: error: ‘std::vector<int>’ is not an accessible base of ‘V’
> 
> which is better than ICE but still wrong, I think

Oops, I was distracted by the range-for loop. That error is for the call to
a.resize() which is of course invalid.

But this valid code still gets an ICE from 4.6

#include <vector>

class V : protected std::vector<int>
{
public:
  void echo()
  {
      for (int x:*this) { }
  }
};


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c++/52458] [c++0x] compiler fails on for(:*this) with non-public inheritance with message: Internal compiler error: Error reporting routines re-entered.
  2012-03-02  2:17 [Bug c++/52458] New: [c++0x] compiler fails on for(:*this) with non-public inheritance with message: Internal compiler error: Error reporting routines re-entered crimaniak at gmail dot com
                   ` (2 preceding siblings ...)
  2012-03-02 10:35 ` redi at gcc dot gnu.org
@ 2012-03-02 12:39 ` redi at gcc dot gnu.org
  2012-03-02 14:50 ` crimaniak at gmail dot com
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2012-03-02 12:39 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-03-02 12:39:03 UTC ---
It works ok if you do the conversion to the base class explicitly:

      for (int x: static_cast<std::vector<int>&>(*this)) { }

I think the range-for code needs to do overload resolution in the class' scope,
but it fails to and tries to say the begin/end members are protected, then gets
into trouble while trying to print the error message.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c++/52458] [c++0x] compiler fails on for(:*this) with non-public inheritance with message: Internal compiler error: Error reporting routines re-entered.
  2012-03-02  2:17 [Bug c++/52458] New: [c++0x] compiler fails on for(:*this) with non-public inheritance with message: Internal compiler error: Error reporting routines re-entered crimaniak at gmail dot com
                   ` (3 preceding siblings ...)
  2012-03-02 12:39 ` redi at gcc dot gnu.org
@ 2012-03-02 14:50 ` crimaniak at gmail dot com
  2012-03-02 17:07 ` redi at gcc dot gnu.org
  2012-10-04 12:14 ` paolo.carlini at oracle dot com
  6 siblings, 0 replies; 8+ messages in thread
From: crimaniak at gmail dot com @ 2012-03-02 14:50 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Alexey Kulentsov <crimaniak at gmail dot com> 2012-03-02 14:49:41 UTC ---
(In reply to comment #4)

>It works ok if you do the conversion to the base class explicitly:
 Yes, I just make public inheritance so this problem is non-blocking for me,
but this was a bug so I post it. It's pity MinGW updated only to 4.6.2.

> I think the range-for code needs to do overload resolution in the class' scope,
> but it fails to and tries to say the begin/end members are protected, then gets
> into trouble while trying to print the error message.

Agree. Diagnostics problem.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c++/52458] [c++0x] compiler fails on for(:*this) with non-public inheritance with message: Internal compiler error: Error reporting routines re-entered.
  2012-03-02  2:17 [Bug c++/52458] New: [c++0x] compiler fails on for(:*this) with non-public inheritance with message: Internal compiler error: Error reporting routines re-entered crimaniak at gmail dot com
                   ` (4 preceding siblings ...)
  2012-03-02 14:50 ` crimaniak at gmail dot com
@ 2012-03-02 17:07 ` redi at gcc dot gnu.org
  2012-10-04 12:14 ` paolo.carlini at oracle dot com
  6 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2012-03-02 17:07 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-03-02 17:06:57 UTC ---
(In reply to comment #5)
> but this was a bug so I post it. It's pity MinGW updated only to 4.6.2.

The newest GCC release, 4.6.3, was only released yesterday!


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c++/52458] [c++0x] compiler fails on for(:*this) with non-public inheritance with message: Internal compiler error: Error reporting routines re-entered.
  2012-03-02  2:17 [Bug c++/52458] New: [c++0x] compiler fails on for(:*this) with non-public inheritance with message: Internal compiler error: Error reporting routines re-entered crimaniak at gmail dot com
                   ` (5 preceding siblings ...)
  2012-03-02 17:07 ` redi at gcc dot gnu.org
@ 2012-10-04 12:14 ` paolo.carlini at oracle dot com
  6 siblings, 0 replies; 8+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-10-04 12:14 UTC (permalink / raw)
  To: gcc-bugs


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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
      Known to work|                            |4.8.0
         Resolution|                            |FIXED

--- Comment #7 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-10-04 12:14:29 UTC ---
Confirmed fixed.


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2012-10-04 12:14 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-02  2:17 [Bug c++/52458] New: [c++0x] compiler fails on for(:*this) with non-public inheritance with message: Internal compiler error: Error reporting routines re-entered crimaniak at gmail dot com
2012-03-02  2:19 ` [Bug c++/52458] " crimaniak at gmail dot com
2012-03-02  9:36 ` redi at gcc dot gnu.org
2012-03-02 10:35 ` redi at gcc dot gnu.org
2012-03-02 12:39 ` redi at gcc dot gnu.org
2012-03-02 14:50 ` crimaniak at gmail dot com
2012-03-02 17:07 ` redi at gcc dot gnu.org
2012-10-04 12:14 ` paolo.carlini at oracle dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).