[Bug c++/17238] New: explicit qualification of member template is rejected

philippe dot haution at mines-paris dot org gcc-bugzilla@gcc.gnu.org
Mon Aug 30 11:20:00 GMT 2004


The instantiation of member templates must be explicitly qualified when the
actual type cannot be infered from the arguments. This used to work OK with gcc
3.2.2 but the hereunder test case now fails to compile.

> gcc pbTemplate.cc -o pbTemplate
error: `template' (as a disambiguator) is only allowed within templates

#include <vector>
#include <string>

using std::vector;
using std::auto_ptr;
using std::string;

namespace BD {

class Tst
{
  public:
    Tst()
    {}

    ~Tst()
    {}
    
    template <typename T>
    auto_ptr<vector<T> >
    lire()
    {
      //cout << "methode generique" << endl;
      auto_ptr<vector<T> > res(new vector<T>);
      return res;
    }
};

}

int main(int argc, char **argv)
{
  BD::Tst t;
  vector<string>& res1 = *t.template lire<string>();
}

-- 
           Summary: explicit qualification of member template is rejected
           Product: gcc
           Version: 3.4.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: philippe dot haution at mines-paris dot org
                CC: gcc-bugs at gcc dot gnu dot org


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



More information about the Gcc-bugs mailing list