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]

Template Exportation


I did some experimentation with exported templates, but work has been
just lying dead lately. If someone have time to look at it, I send a
.tar.gz file with includes

  * Patches to the gcc tree, and ChangeLog entries (but the pathes are
    not meant to be applied to the main branch).  This implements an
    extension to the object files.

  * README with outline of the idea

  * some sources to link libraries and programs, not (yet) incorporated
    into the compiler

  * a testsuite directory for demonstration

It's only a skeleton for a possible implementation. I just don't have
time to complete it now. I would suggest maybe to apply some selected
parts of the patches to the main branch,

  * The patch to decl2.c is a bugfix.  I repeat it below for gcc
    maintainers convenience.

  * Patch spew.c and parse.y and replace flag_export with 0 in the
latter
    to check the syntax of the use of the export keyword.

I would like a CCs of mails related to this, if you remember -;

Enjoy,
 -petter.


[---]$ cat 14.7.2.2.cc
//  From 14.7.2.2 in the standard
namespace N { template<class T> void f(T&) { } }
template void N::f<int>(int&);

[---]$ g++ 14.7.2.2.cc
14.7.2.2.cc:3: `N::f(int &)' should have been declared inside `N'


2000-07-xx  Petter Urkedal  <petter@matfys.lth.se>

        * decl2.c (set_decl_namespace): Don't complain about missing
        declaration here if processing_explicit_instantiation.

Index: gcc/cp/decl2.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/decl2.c,v
retrieving revision 1.387
diff -c -p -r1.387 decl2.c
*** decl2.c     2000/08/18 09:49:06     1.387
--- decl2.c     2000/08/21 09:24:20
*************** set_decl_namespace (decl, scope, friendp
*** 4659,4665 ****
        /* Since decl is a function, old should contain a function decl.
*/
        if (!is_overloaded_fn (old))
        goto complain;
!       if (processing_template_decl || processing_specialization)
        /* We have not yet called push_template_decl to turn the
           FUNCTION_DECL into a TEMPLATE_DECL, so the declarations
           won't match.  But, we'll check later, when we construct the
--- 4659,4666 ----
        /* Since decl is a function, old should contain a function decl.
*/
        if (!is_overloaded_fn (old))
        goto complain;
!       if (processing_template_decl || processing_specialization ||
!         processing_explicit_instantiation)
        /* We have not yet called push_template_decl to turn the
           FUNCTION_DECL into a TEMPLATE_DECL, so the declarations
           won't match.  But, we'll check later, when we construct the

g++export.tgz


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