------- Additional Comments From jean-pierre dot chevallet at imag dot fr 2005-01-06 13:44 ------- Subject: RE: No more possible to have a template function that uses a nested class of a template class
Thank you very much for your answer, and I'm very impressed : you have answer very quicky !! May I ask you what follows my problem : instead of a normal function I have an operator in the "real" code I try to compile. The operator is << : but how to explicitly specify template argument when the tamplate function is an operator ? Thank you again ! PS: in fact I'm little disappointed the way C++ evolve during last years, I feel have more and more difficulties to make all the code I have in charge compiling when new version of gcc are available, specially for the templates. Any advice ? ****************************************** Jean-Pierre Chevallet IPAL-CNRS Image Processing and Application Lab Institute for Infocomm Research I2R 21 Heng Mui Keng Terrace Singapore 119613 http://ipal.imag.fr [EMAIL PROTECTED] Tel work: +65 6874 8526 Fax: +65 6775 5014 Tel home: +65 6256 6141 > -----Original Message----- > From: giovannibajo at libero dot it [mailto:[EMAIL PROTECTED] > Sent: jeudi 6 janvier 2005 18:13 > To: [EMAIL PROTECTED] > Subject: [Bug c++/19288] No more possible to have a template function that > uses a nested class of a template class > > > ------- Additional Comments From giovannibajo at libero dot it 2005-01-06 > 10:13 ------- > This is invalid. Within the expression "C1<T>::nested", T cannot be > deduced > because it is in an nondeduced context. > > ISO/ANSI C++ standard reference: [temp.deduct.type]/4: > > The nondeduced contexts are: > > -- The nested-name-specifier of a type that was specified using a > qualified-id. > > -- A type that is a template-id in which one or more of the template- > arguments is an expression that references a template-parameter. > > When a type name is specified in a way that includes a nondeduced > context, all of the types that comprise that type name are also > nondeduced. However, a compound type can include both deduced and > nondeduced types. [Example: If a type is specified as A<T>::B<T2>, > both T and T2 are nondeduced. Likewise, if a type is specified as > A<I+J>::X<T>, I, J, and T are nondeduced. If a type is specified as > void f(typename A<T>::B, A<T>), the T in A<T>::B is nondeduced but the > T in A<T> is deduced. > > > Also notice the end of paragraph 3: "If a template parameter is used only > in > nondeduced contexts and is not explicitly specified, template argument > deduction fails." > > > Using a specialization as a workaround is a bit bloating. The correct way > is to > explicitly specify the template arguments which cannot be deduced when > calling > the template. In your case, you can use f2<float>(n). > > -- > What |Removed |Added > ------------------------------------------------------------------------ -- > -- > Status|UNCONFIRMED |RESOLVED > Resolution| |INVALID > > > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19288 > > ------- You are receiving this mail because: ------- > You reported the bug, or are watching the reporter. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19288