c++/692: Explicit instantiation of template outside namespace rejected

wolfgang.bangerth@iwr.uni-heidelberg.de wolfgang.bangerth@iwr.uni-heidelberg.de
Thu Oct 26 05:36:00 GMT 2000


>Number:         692
>Category:       c++
>Synopsis:       Explicit instantiation of template outside namespace rejected
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          rejects-legal
>Submitter-Id:   net
>Arrival-Date:   Thu Oct 26 05:36:00 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator:     Wolfgang Bangerth
>Release:        unknown-1.0
>Organization:
>Environment:
gcc 2.95.2 and present snapshot at CodeSourcery
>Description:
Explicitely instantiating a template outside the namespace
in which it was declared is rejected. However, 14.7.2.2
marks this example as valid. (Besides, the error message
does not tell the problem.)

To see this, compile this:
-----------------------------------
namespace X {  template <class T> void f () {};   };
template void X::f<int> ();
-----------------------------------
to obtain
  ns.cc:2: `X::f()' should have been declared inside `X'

This happens on both gcc2.95.2 and the present snapshot.
>How-To-Repeat:

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the Gcc-bugs mailing list