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]

Dependent base class and CVS head



The attached snippet is compiled fine (in the respective "pedantic" modes) by G++ 3.3, by Comeau C++ 4.3.0.1, and by the latest patch version of Intel's C++ compiler 7.1. However G++ "gcc version 3.4 20030714 (experimental)" gives

test2.cc: In member function `void D<T>::foo()':
test2.cc:16: error: `i' undeclared (first use this function)
test2.cc:16: error: (Each undeclared identifier is reported only once for each
   function it appears in.)
test2.cc:17: error: there are no arguments to `bar' that depend on a template
   parameter, so a declaration of `bar' must be available
test2.cc:17: error: (if you use `-fpermissive', G++ will accept your code, but
   allowing the use of an undeclared name is deprecated)

Who is right?
Cheers

Roberto

--
Prof. Roberto Bagnara
Computer Science Group
Department of Mathematics, University of Parma, Italy
http://www.cs.unipr.it/~bagnara/
mailto:bagnara@cs.unipr.it


template <typename T> class B { public: int i; void bar() { } };

template <typename T>
class D : public B<T> {
public:
  using B<T>::i;
  using B<T>::bar;
  void foo() {
    i = 1;
    bar();
  }
};


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