[Bug java/46983] New: Diagnostic about change in meaning of name in class misses some cases
jason at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Dec 16 20:58:00 GMT 2010
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46983
Summary: Diagnostic about change in meaning of name in class
misses some cases
Product: gcc
Version: 4.6.0
Status: UNCONFIRMED
Keywords: diagnostic
Severity: normal
Priority: P3
Component: java
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: jason@gcc.gnu.org
CC: jason@gcc.gnu.org, rth@gcc.gnu.org
In C++, it is ill-formed, no diagnostic required, for a lookup to have
different meanings at the point of lookup and in the context of the complete
class. G++ gives diagnostics about some instances of this, but misses this
one:
template <class T>
struct A
{
typedef typename T::Y Z;
};
struct B
{
typedef int Y;
};
struct C: B
{
struct N: A<C> { };
typedef char Y;
};
int ar[sizeof(C::N::Z) == sizeof(int) ? 1 : -1];
Here when we instantiate A<C>, C is not yet complete, so when we lookup C::Y we
find B::Y. If we were to do the lookup in the full class, it would find C::Y
instead.
More information about the Java-prs
mailing list