I have some template code that fails with move to v3.4.4

snProbeItem *
snProbeSet::getObjectItem(oaDesignObject *designObject) const
{
 if (designObject->isBlockObject()) {
   oaBlockObject *blockObj = static_cast<oaBlockObject *>(designObject);

   if (blockObj->isInst()) {
     oaInst *inst = static_cast<oaInst *>(blockObj);

     // This works fine, "oaInst *&" matches template.
     return getItem(inst);
   } else if (blockObj->isBoundary()) {
     // This fails, "oaBoundary *&" does not match template.
     return getItem(static_cast<oaBoundary *>(blockObj));
   }
}

I need to create an explicit temporary variable for the code
to compile.

snProbeSet.cc:1497: error: no matching function for call to
`snProbeSet::getItem(OpenAccess_4::oaBoundary*) const'
snProbeSet.h:164: note: candidates are: snProbeItemObject<Object>*
snProbeSet::getItem(Object&) const [with Object = OpenAccess_4::oaBoundary*] 


 template <typename Object>
 snProbeItemObject<Object> *getItem(Object &probedItem) const {
   snSimpleProbeTransaction lock(const_cast<snProbeSet &>(*this));

   return getItem<Object>(lock, probedItem);
 }


-- 
           Summary: Templates don't create reference to pointer temporary
           Product: gcc
           Version: 3.4.4
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: no_spam at earthlink dot net


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

Reply via email to