The following code compiled in g++ 3.3.4, but does not compile in the latest 
4.0.x
Seems like a regression testing oversight.
 
 
template <typename T, typename ID_TYPE=long>
class db_reference {
  private:
    T r;
  public:
    ID_TYPE &id;
    db_reference(ID_TYPE req_id=0);
    T &get();
    std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) 
const;
    std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=1,
        const char *tag=0) const;
    void parse_xml(std::string &buf, const char *tag);
    void parse(const std::string &buf);
    void parse(const SQL_ROW &buf);
    operator T() const;
    T *operator ->();
    const T *operator ->() const;
    db_reference<T,ID_TYPE> &operator =(T &t);
    db_reference<T,ID_TYPE> &operator =(const db_reference<T,ID_TYPE> &t);
};
 
template <typename T, typename ID_TYPE>
db_reference<T,ID_TYPE>::db_reference<T,ID_TYPE>(ID_TYPE req_id) : id(*(ID_TYPE
*)(&(r.id))) {
  id=req_id;
}
 
The error is
  error: invalid use of constructor as a template
  note: use ‘db_reference<T, ID_TYPE>::db_reference’ instead of ‘db_reference<T,
ID_TYPE>::db_reference<T, ID_TYPE>’ to name the constructor in a qualified name

-- 
           Summary: invalid use of constructor as a template
           Product: gcc
           Version: 4.0.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: harold at alum dot mit dot edu
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: 4.0.x
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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

Reply via email to