The following test program compiles without error or warning on g++ (versions
2.95.3, 3.4.5, 4.0.2, 4.1.0, 4.1.1, and 4.3-20070323):

template<class T>
static void F();

template<>
static void F<int>();  // Explicit specialization with storage class specifier

The C++ standard seems to disallow this.  From 7.1.1 - Storage class specifiers
[dcl.stc], para 1:

...  A storage-class-specifier shall not be specified in an explicit
specialization (temp.expl.spec) or an explicit instantiation (temp.explicit)
directive.

I couldn't find an existing report of this, but may well have missed one.


-- 
           Summary: g++ accepts a storage-class-specifier on a template
                    explicit specialization
           Product: gcc
           Version: 4.1.1
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: simon_baldwin at yahoo dot com


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

Reply via email to