[Bug c++/17410] Specialization of nested template rejected because of unrelated declaration

cppljevans at cox-internet dot com gcc-bugzilla@gcc.gnu.org
Sat Sep 11 14:02:00 GMT 2004


------- Additional Comments From cppljevans at cox-internet dot com  2004-09-11 14:02 -------
(In reply to comment #2)
> This is weird. Redux:
> 
> -------------------------------------------------------
> template <class>
> struct Outer {
>   template <class> struct Inner {};
> }; 
> 
> template <class T>
> struct A;
> 
> template <template <class> class Q, class P>
> struct A <Q<P> > {};
> 
> template <class T> struct UNRELATED;
> template <class T> struct UNRELATED<Outer<void>::Inner<T*> >;
> 
> template struct A<Outer<void>::Inner<int*> >;
> -------------------------------------------------------
> 
> This should be accepted, because the specialization of A should be matched
> (with Q = "Outer<void>::Inner", and P = "int*" of course). Instead, it does 
> not, *unless* you comment the UNRELATED template.

My new attachment contains a run which shows gcc instantiates
the specialization when the template argument is not nested; 
however, gcc instantiates the general template when the template
argument is nested.  icc does it correctly.  I've also attached
the test.mk makefile which I used.

> 
> Looks like something gets alterated in the tsubst process. Not a regression, 
> though (the original code manages to be rejected everywhere, while the redux 
> even ICEs older compilers).



-- 


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



More information about the Gcc-bugs mailing list