[Bug c++/16174] [3.4/3.5 Regression] deducing top-level consts

nathan at codesourcery dot com gcc-bugzilla@gcc.gnu.org
Fri Jun 25 08:55:00 GMT 2004


------- Additional Comments From nathan at codesourcery dot com  2004-06-25 08:32 -------
Subject: Re:  [3.4/3.5 Regression] deducing top-level consts

giovannibajo at libero dot it wrote:
> ------- Additional Comments From giovannibajo at libero dot it  2004-06-25 01:06 -------
> Nathan,
> 
> there is something I don't understand here, and with your patch. This is what 
> should happen in my opinion:
> 
> - We try to instantiate the declaration of the templated copy ctor to add it to 
> the overload set.
> - We deduce U = K<int> (no const here!) from the first parameter
> - We substitute U into the non deduced context (second parameter). This causes 
> the instantiation of A<K<int> > (still no const).
> - A<K<int> > matches the general template (not the specialization), which is 
> incomplete. This triggers SFINAE.
> - The declaration we were trying to instantiate is discarded and not added to 
> the overload set.
aah, it appear I missed the lack of const in that final templated
copy ctor with the default arg.  Why is C++ so complicated? Make it simpler.


> I think I read a DR where John Spicer was saying that it is unfeasable to shut 
> all the possible errors that could be emitted during (possibly cascaded)
> template instantiations for the sake of SFINAE.
Yes, but I thought EDG coped with this kind of case, I don't know.

> In fact, this is what EDG does. 
> If you try it on g++.old-deja/g++.pt/crash30.C, it will emit diagnostic also on 
> the line where you removed the dg-error.
I did not know that

nathan



-- 


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



More information about the Gcc-bugs mailing list