public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/15096] New: parse error with templates and pointer to const member
@ 2004-04-23 11:05 wolfgang dot roehrl at de dot gi-de dot com
  2004-04-23 14:03 ` [Bug c++/15096] " giovannibajo at libero dot it
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: wolfgang dot roehrl at de dot gi-de dot com @ 2004-04-23 11:05 UTC (permalink / raw)
  To: gcc-bugs

We use the compiler to generate code for a PowerPc processor. 
Used invokation line for the C++ compiler:

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



// example program 1

template <typename T_>
class C1
{
public:
    C1 ();
    ~C1 ();
    const int C1<T_>::* getPtr () const;

private:
    int x;
    T_ y;
};


template <typename T_>
const int C1<T_>::* C1<T_>::getPtr () const
{ return &C1<T_>::x; }                      // <-- line 17


The compiler gives the following error message:
 
z.CPP:17: error: too few template parameter lists in declaration of `const int 
   C1<T_>::* C1<T_>::getPtr() const'


We get no error message if a typedef is introduced:

// example program 2

template <typename T_>
class C1
{
    typedef const int C1<T_>::* T_C1_INT_PTR;

public:
    C1 ();
    ~C1 ();
    T_C1_INT_PTR getPtr () const;

private:
    int x;
    T_ y;
};


template <typename T_>
typename C1<T_>::T_C1_INT_PTR C1<T_>::getPtr () const
{ return &C1<T_>::x; }

-- 
           Summary: parse error with templates and pointer to const member
           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=15096


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

end of thread, other threads:[~2004-06-14 17:15 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-04-23 11:05 [Bug c++/15096] New: parse error with templates and pointer to const member wolfgang dot roehrl at de dot gi-de dot com
2004-04-23 14:03 ` [Bug c++/15096] " giovannibajo at libero dot it
2004-04-23 14:24 ` [Bug c++/15096] [3.3/3.4/3.5 Regression] " pinskia at gcc dot gnu dot org
2004-06-06  3:39 ` giovannibajo at libero dot it
2004-06-12 21:32 ` mmitchel at gcc dot gnu dot org
2004-06-14 15:53 ` cvs-commit at gcc dot gnu dot org
2004-06-14 15:59 ` cvs-commit at gcc dot gnu dot org
2004-06-14 17:15 ` 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).