This is the mail archive of the gcc-bugs@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]
Other format: [Raw text]

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


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


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