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



>>>>> "Gabriel" == Gabriel Dos Reis <Gabriel.Dos-Reis@dptmaths.ens-cachan.fr> writes:

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

Yes, you'll note that I'm listed in the PROJECTS file as working on
template friends.  I have a mostly-working fix; a few lingering
problems with member template friends.  I should have a patch ready in
another week or so.

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

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



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

-- 
Mark Mitchell		mmitchell@usa.net
Stanford University	http://www.stanford.edu



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