Don't suppose you can deprecate this non-ISO C++ standard usage of the
following proprietary G++ extensions:

          extern template int max (int, int);
          inline template class Foo<int>;
          static template class Foo<int>;

... as summarised at http://www.dis.com/gnu/gcc/Template-Instantiation.html.

The problem with these is that they tempt some programmers to use them (a)
without really understanding what they are doing as documentation is somewhat
light on these extensions (b) in the mistaken belief it is standard C++, not a
proprietary G++ extension (c) that non-G++ compilers ignore it, which they may
or may not do in a predictable fashion. As an example, various versions of MSVC
as well as other compilers can throw some odd errors.

I have no problem with these being replaced with something like say:

          __attribute__((template_extern)) template int max (int, int);
          __attribute__((template_inline)) template class Foo<int>;
          __attribute__((template_static)) template class Foo<int>;

This then does not give the illusion that these misuses of extern, inline and
static with template declarations is proper C++.

Cheers,
Niall


-- 
           Summary: Non-ISO template qualifiers
           Product: gcc
           Version: 4.1.1
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: s_gccbugzilla at nedprod dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29757

Reply via email to