This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/14920] New: Bug with templating.


// Time-stamp: <2004-04-11 23:35:06 andyw>
// Copyright (C) 2004 Andreas Warkentin
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
// Compiler information with strange behavior (bug??) noted below...
// Reading specs from /usr/lib/gcc-lib/i486-slackware-linux/3.3.2/specs
// Configured with: ../gcc-3.3.2/configure --prefix=/usr --enable-shared
// --enable-threads=posix --enable-__cxa_atexit --disable-checking
// --with-gnu-ld --verbose --target=i486-slackware-linux
// --host=i486-slackware-linux
// Thread model: posix
// gcc version 3.3.2
                                                                                
class A
{
public:
                                                                                
  A() {};
  ~A() {};
  template<typename T> void b()
  {
  }
  template<typename T> void c()
  {
  }
};
                                                                                
template<typename T> void b()
{
}
                                                                                
template<typename T> void d()
{
}
                                                                              
template<typename T> void func1(A &object)
{
  object.b<T>();
                                                                              
  // bug.cpp:55: error: parse error before `>' token
  // *** SHOUDN'T THIS STATEMENT COMPILE NORMALLY?!?!?!?!?! ***
  object.c<T>();
                                                                              
  //bug.cpp:60: error: `d' undeclared (first use this function)
  //bug.cpp:60: error: (Each undeclared identifier is reported only once for
  //each function it appears in.) (This error is sane, and completely normal)
  object.d<T>();
                                                                              
  // bug.cpp:64: error: parse error before `>' token
  // *** SHOULDN'T THE COMPILER INSTEAD COMPLAIN ABOUT `bar' undeclared? 
  object.bar<T>();
}
                                                                              
int main()
{
  A obj;
  func1<int>(obj);
  return 0;
}

-- 
           Summary: Bug with templating.
           Product: gcc
           Version: 3.3.2
            Status: UNCONFIRMED
          Severity: critical
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: andyw at imsa dot edu
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: gcc version 3.3.2
  GCC host triplet: i486-slackware-linux
GCC target triplet: i486-slackware-linux


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]