public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/41560]  New: Bus error on operator[] override
@ 2009-10-03 22:00 markleone at gmail dot com
  2009-10-03 22:02 ` [Bug c++/41560] " markleone at gmail dot com
  2009-10-03 22:19 ` rguenth at gcc dot gnu dot org
  0 siblings, 2 replies; 3+ messages in thread
From: markleone at gmail dot com @ 2009-10-03 22:00 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 780 bytes --]

I'm getting a bus error on the following override of operator[].  (Not sure if
it's valid.)

#include <vector>
template<typename T>
class MyVector : public std::vector<T>
{
    const T& operator[](size_t n) const
    {
        return typename std::vector<T>operator[](n);
    }
};


test.cpp: In member function ‘const T& MyVector<T>::operator[](size_t) const’:
test.cpp:7: internal compiler error: Bus error


-- 
           Summary: Bus error on operator[] override
           Product: gcc
           Version: 4.0.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: markleone at gmail dot com


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


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

* [Bug c++/41560] Bus error on operator[] override
  2009-10-03 22:00 [Bug c++/41560] New: Bus error on operator[] override markleone at gmail dot com
@ 2009-10-03 22:02 ` markleone at gmail dot com
  2009-10-03 22:19 ` rguenth at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: markleone at gmail dot com @ 2009-10-03 22:02 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from markleone at gmail dot com  2009-10-03 22:01 -------
The bus error disappears when it's fixed with '::' between vector<T> and
operator[] in the return statement.


-- 


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


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

* [Bug c++/41560] Bus error on operator[] override
  2009-10-03 22:00 [Bug c++/41560] New: Bus error on operator[] override markleone at gmail dot com
  2009-10-03 22:02 ` [Bug c++/41560] " markleone at gmail dot com
@ 2009-10-03 22:19 ` rguenth at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-10-03 22:19 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 698 bytes --]



------- Comment #2 from rguenth at gcc dot gnu dot org  2009-10-03 22:19 -------
Not valid.  At least 4.0.4 and later say

t.C: In member function ‘const T& MyVector<T>::operator[](size_t) const’:
t.C:7: error: expected `(' before ‘operator’
t.C:7: error: expected ‘;’ before ‘operator’


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.0.4


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


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

end of thread, other threads:[~2009-10-03 22:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-10-03 22:00 [Bug c++/41560] New: Bus error on operator[] override markleone at gmail dot com
2009-10-03 22:02 ` [Bug c++/41560] " markleone at gmail dot com
2009-10-03 22:19 ` rguenth at gcc dot gnu dot org

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).