This is the mail archive of the gcc@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]

Bug in template declaration parsing



EGCS failed to correctly parse the following code taken from 
X3J16/97-0079 WG21/N1117:

template<class T> class task;
template<class T> task<T>* preempt(task<T>*);
template<class T> class task {
        // ...
    friend void next_time();
    friend void process(task<T>*);
    friend task<T>* preempt<T>(task<T>*);
    template<class C> friend int func(C);	// <== line 8
    
    friend class task<int>;
    template<class P> friend class frd;		// <== line 11
        // ...
};

piano% g++ -v; g++ -c bug.C 
Reading specs from
/usr/public/egcs/lib/gcc-lib/sparc-sun-solaris2.5/egcs-2.91.07/specs
gcc version egcs-2.91.07 980205 (gcc-2.8.0 release)
bug.C:6: warning: friend declaration `void process(class task<T> *)'
bug.C:6: warning:   will not be treated as a template instantiation
bug.C:6: warning:   unless you compile with -fguiding-decls
bug.C:6: warning:   or add <> after the function name
bug.C:8: warning: friend declaration `int func(C)'
bug.C:8: warning:   will not be treated as a template instantiation
bug.C:8: invalid member template declaration
bug.C:11: invalid member template declaration



-- Gaby
"One reason that life is complex is that it has a 
real part and imaginary part." -- Andrew Koenig


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