Why this change? It could break a lot of code

The Software Team software@solmersa.com
Thu Aug 28 09:00:00 GMT 2003


The below change planned for Gcc 3.4, is really necessary?  I think it would
break a lot of code, and it goes against the usual practice in C++: (derived
class inherits all the functionality from base, theres is an implicit this->
resolution for accesing members, ::name is required to access identifiers
with the same name of a class member, etc.)

Because a derived templated class is just another case of the usual
inheritance, the behavior below is contradictory.

Why this change?, is because of the "C++ Standard"?.  Maybe in this case the
"C++ Standard" is wrong.



CHANGE PROPOSED:

In a template definition, unqualified names will no longer find members of a
dependent base. For example,
        template <typename T>struct B {
	  int m;
	  int n;
	  int f ();
	  int g ();
	};
	int n;
	int g ();
	template <typename T> struct C : B<T> {
	  void g ()
	  {
	    m = 0; // error
	    f ();  // error
	    n = 0; // ::n is modified
	    g ();  // ::g is called
	  }
	};



More information about the Gcc mailing list