[Bug c++/16635] New: g++ doesn't diagnose instantiation of template that uses incomplete type

geoffk at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Mon Jul 19 19:45:00 GMT 2004


Consider the following:

template <class T> T * foo (T * x)
{ 
  return x++;
}

struct aclass;

aclass *
addone (aclass * x)
{ 
  return foo<aclass>(x);
}

struct aclass
{ 
  int x;
};

At the point where foo<aclass> is instantiated, 'aclass' is incomplete, and 'x++' requires it to be 
complete, so this program is not well-formed, and a diagnostic is required.

-- 
           Summary: g++ doesn't diagnose instantiation of template that uses
                    incomplete type
           Product: gcc
           Version: 3.5.0
            Status: UNCONFIRMED
          Keywords: accepts-invalid
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: geoffk at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org
  GCC host triplet: powerpc-apple-darwin7.3
GCC target triplet: powerpc-apple-darwin7.3


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



More information about the Gcc-bugs mailing list