public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/18681] New: template friend declaration not recognized
@ 2004-11-26 13:52 wolfgang dot roehrl at de dot gi-de dot com
  2004-11-26 15:34 ` [Bug c++/18681] " pinskia at gcc dot gnu dot org
                   ` (25 more replies)
  0 siblings, 26 replies; 27+ messages in thread
From: wolfgang dot roehrl at de dot gi-de dot com @ 2004-11-26 13:52 UTC (permalink / raw)
  To: gcc-bugs

Dear all,

I would like to post a fault report for the GNU C/C++ compiler 3.3-e500.

We use the compiler to generate code for a PowerPC processor.

Used invokation line for the GNU C++ compiler:

ccppc -c -x c++ -ansi -Wall -Werror -mcpu=8540 -fverbose-asm -mbig
      -fmerge-templates -mmultiple -mno-string -mstrict-align -O3
      -fno-exceptions -fno-rtti -fno-builtin-printf
      -I<different include paths>
      -D<differen #define's>
      K.CPP -oK.O



// example program

template <typename> class C1;
template <typename> class C2;

template <typename T_>
class C2<T_*>
{
    typedef T_* T_PAR_TYPE;        <---- k.CPP, line 7
    friend class C1<T_*>;          <---- class C1<int (*)[20]> is a friend
};

template <typename T_>
class C1
{
//public:                          <---- k.CPP, line 14
    typedef typename C2<T_>::T_PAR_TYPE T_PAR;
    struct S1
    {
        T_PAR par;                 <---- k.CPP, line 18
    };

    static void fx (S1&);

public:
    void f (T_PAR ptr);
};


template <typename T_>
void C1<T_>::f (T_PAR ptr_)
{
    S1 s1;                         <---- k.CPP, line 31

    fx (s1);
}



typedef int T_MEM[20];


void f (T_MEM* p1)
{
    C1<T_MEM*> c1;

    c1.f (p1);                     <---- k.CPP, line 45
}



The compiler gives the following error messages:

k.CPP: In instantiation of `C1<int (*)[20]>::S1':
k.CPP:31:   instantiated from `void C1<<anonymous template type parameter> >::f
(typename C2<<anonymous template type parameter> >::T_PAR_TYPE) [with T_ = int 
(*)[20]]'
k.CPP:45:   instantiated from here
k.CPP:7: error: `typedef int (*C2<int (*)[20]>::T_PAR_TYPE)[20]' is private
k.CPP:18: error: within this context


The error messages remain the same if line 14 is un-commented. This seems OK
since the access specification of C1<>::T_PAR should not affect C1<>::S1. The
compiler translates only without complaints if C2<>::T_PAR_TYPE is made public.



With kind regards
W. Roehrl

-- 
           Summary: template friend declaration not recognized
           Product: gcc
           Version: 3.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: wolfgang dot roehrl at de dot gi-de dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: sparc-sun-solaris2.5.1
  GCC host triplet: i386-pc-mingw32
GCC target triplet: powerpc-wrs-vxworks


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


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

end of thread, other threads:[~2005-07-06 17:03 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-11-26 13:52 [Bug c++/18681] New: template friend declaration not recognized wolfgang dot roehrl at de dot gi-de dot com
2004-11-26 15:34 ` [Bug c++/18681] " pinskia at gcc dot gnu dot org
2004-11-26 16:31 ` [Bug c++/18681] [3.3/3.4/4.0 regression] " lerdsuwa at gcc dot gnu dot org
2004-11-26 16:31 ` lerdsuwa at gcc dot gnu dot org
2004-11-26 16:34 ` pinskia at gcc dot gnu dot org
2004-11-26 22:45 ` giovannibajo at libero dot it
2004-11-26 23:11 ` pinskia at gcc dot gnu dot org
2004-11-27 15:53 ` lerdsuwa at gcc dot gnu dot org
2004-11-27 16:13 ` lerdsuwa at gcc dot gnu dot org
2004-11-27 16:20 ` [Bug c++/18681] " lerdsuwa at gcc dot gnu dot org
2004-11-29  7:12 ` wolfgang dot roehrl at de dot gi-de dot com
2004-11-29 11:34 ` giovannibajo at libero dot it
2004-11-29 14:00 ` lerdsuwa at gcc dot gnu dot org
2004-11-29 14:01 ` lerdsuwa at gcc dot gnu dot org
2004-11-29 14:11 ` [Bug c++/18681] [3.3/3.4/4.0 Regression] " lerdsuwa at gcc dot gnu dot org
2004-11-30 15:02 ` lerdsuwa at gcc dot gnu dot org
2004-12-02 12:05 ` lerdsuwa at gcc dot gnu dot org
2004-12-12 12:39 ` lerdsuwa at gcc dot gnu dot org
2004-12-13 14:19 ` lerdsuwa at gcc dot gnu dot org
2004-12-21 15:50 ` lerdsuwa at gcc dot gnu dot org
2005-03-16 13:17 ` [Bug c++/18681] [3.3/3.4/4.0/4.1 " reichelt at gcc dot gnu dot org
2005-04-17  4:10 ` mmitchel at gcc dot gnu dot org
2005-04-23 15:28 ` lerdsuwa at gcc dot gnu dot org
2005-05-19 17:08 ` lerdsuwa at gcc dot gnu dot org
2005-05-19 17:44 ` mmitchel at gcc dot gnu dot org
2005-06-07 14:58 ` [Bug c++/18681] [3.4/4.0/4.1 " lerdsuwa at gcc dot gnu dot org
2005-07-06 17:04 ` mmitchel 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).