public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/35641]  New: ICE on overload of friend function definition inside a class
@ 2008-03-19 18:26 philippe at fornux dot com
  2008-03-22 23:52 ` [Bug c++/35641] " fang at csl dot cornell dot edu
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: philippe at fornux dot com @ 2008-03-19 18:26 UTC (permalink / raw)
  To: gcc-bugs

The following:
**************

template <typename T>
    struct Message
    {
        friend ostream & operator << (ostream & out, const Message & self)
        {
            cout << __PRETTY_FUNCTION__ << endl;

            return out;
        }
    };


typedef Message<int> IntMsg;


inline ostream & operator << (ostream & out, const IntMsg & self)
{
    cout << __PRETTY_FUNCTION__ << endl;

    return out;
}

int main()
{
    IntMsg m;

    cout << m << endl;
}



Produces:
*********

templateoverload.cpp: In function `std::ostream& operator<<(std::ostream&,
const IntMsg&)':
templateoverload.cpp:33:   instantiated from here
templateoverload.cpp:0: internal compiler error: in change_decl_assembler_name,
at cgraph.c:541


Resolved with out-of-class definition:
**************************************

template <typename T>
    inline ostream & operator << (ostream & out, const Message<T> & self)
    {
        cout << __PRETTY_FUNCTION__ << endl;

        return out;
    }


-- 
           Summary: ICE on overload of friend function definition inside a
                    class
           Product: gcc
           Version: 3.4.5
            Status: UNCONFIRMED
          Severity: critical
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: philippe at fornux dot com
 GCC build triplet: gcc version 3.4.5 (mingw special)
  GCC host triplet: Windows XP
GCC target triplet: Mingw


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


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

end of thread, other threads:[~2008-07-04 16:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-19 18:26 [Bug c++/35641] New: ICE on overload of friend function definition inside a class philippe at fornux dot com
2008-03-22 23:52 ` [Bug c++/35641] " fang at csl dot cornell dot edu
2008-03-29 17:11 ` [Bug c++/35641] [4.1 regression] " reichelt at gcc dot gnu dot org
2008-07-04 16:19 ` jsm28 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).