[cfe-dev] template specialization and redecls

Douglas Gregor dgregor at apple.com
Mon Nov 29 15:58:15 PST 2010


On Nov 29, 2010, at 3:17 PM, Craig Silverstein wrote:

> } That sounds very broken; are B::C and ::C somehow getting tangled
> } together?
> 
> I don't think so.  The same problem is in evidence even with the
> following code (where there's no B::C):
> 
>  struct B {
>   template<class T> friend class C;
>   friend class C<float>;
>  };
> 
>  template<class T> class C {
>  };
> 
>  C<int>* foo;
> 
> I agree it seems very broken. :-)


I wouldn't be surprised at all if we had problems with the redeclaration chain for 'C' in this case. There are a number of bugs relating to redeclarations and friends where, e.g., friend declarations don't show up in the redeclaration chain when they should. It's at the point where we need to implement a completely different approach to finding friends. Along the way, it'd be nice to get redeclaration chains that handle locally-scoped extern declarations, e.g.,

	void f() {
		extern int i;
	}

	void g() {
		extern int i;
	}

We have a hack to handle this in C, but it needs to be fixed for C++ and generalized to also support friends, which have the same kind of visible-for-redeclaration-but-not-for-normal-lookup issues.

	- Doug



More information about the cfe-dev mailing list