This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: c++: too many templates?


2008/10/23 Arturs Zoldners <az@tuci.lv>:
> On Thu, 2008-10-23 at 04:14 -0700, @ wrote:
>> why the following code cannot be compiled?
>>
>> template <typename TC>
>> class C
>> {
>>       template <typename TF>
>>       void f() {}
>> };
>>
>> template <typename T>
>> void test()
>> {
>>       C<T> c;
>>       c.f<int>();
>> }
>>
>> gcc-4.3.2 on "c.f<int>();" reports error: expected primary-expression before
>> 'int'
>
> Try:
>
> void test()
> {
>        C<T> c;
>        c.template f<int>();
> }

Is this syntax described in TC++PL?  I looked through my copy and
couldn't find it.

-- 
Andrew Bell
andrew.bell.ia@gmail.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]