[vtkusers] error: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second

Martin Costabel costabel at wanadoo.fr
Sun Nov 13 03:55:55 EST 2005


Martin Baumann wrote:
> Hi,
> 
> I have a problem compiling VTK4.2 on a Suse 10 system.
> I get the following errors:
[]
> /home/martin/local/src/VTK/VTK4.2/IO/vtkBMPReader.cxx: In function ‘void 
> vtkBMPReaderUpdate2(vtkBMPReader*, vtkImageData*, OT*) [with OT = double]’:
> /home/martin/local/src/VTK/VTK4.2/IO/vtkBMPReader.cxx:545: instantiated 
> from here
> /home/martin/local/src/VTK/VTK4.2/IO/vtkBMPReader.cxx:507: error: ISO 
> C++ says that these are ambiguous, even though the worst conversion for 
> the first is better than the worst conversion for the second:
> /usr/include/c++/4.0.2/bits/postypes.h:175: note: candidate 1: 
> std::fpos<_StateT> std::fpos<_StateT>::operator+(std::streamoff) const 
> [with _StateT = mbstate_t]
> /home/martin/local/src/VTK/VTK4.2/IO/vtkBMPReader.cxx:507: note: 
> candidate 2: operator+(std::streamoff, long int) <built-in>

This comes from increased anality of recent gcc compiler versions. It 
has been fixed on CVS. From the cvs log for this file:

revision 1.45
date: 2003-10-19 14:38:03 +0000;  author: dgobbi;  state: Exp;  lines: +5 -5
ERR: C++ ambiguity compile error: typecast operands of '+' to same type

% cvs diff -r1.44 -r1.45 IO/vtkBMPReader.cxx
Index: IO/vtkBMPReader.cxx
===================================================================
RCS file: /cvsroot/VTK/VTK/IO/vtkBMPReader.cxx,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -b -w -r1.44 -r1.45
--- IO/vtkBMPReader.cxx 10 Sep 2003 19:41:56 -0000      1.44
+++ IO/vtkBMPReader.cxx 19 Oct 2003 14:38:03 -0000      1.45
@@ -3,8 +3,8 @@
    Program:   Visualization Toolkit
    Module:    $RCSfile: vtkBMPReader.cxx,v $
    Language:  C++
-  Date:      $Date: 2003/09/10 19:41:56 $
-  Version:   $Revision: 1.44 $
+  Date:      $Date: 2003/10/19 14:38:03 $
+  Version:   $Revision: 1.45 $

    Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen
    All rights reserved.
@@ -23,7 +23,7 @@
  #include "vtkObjectFactory.h"
  #include "vtkPointData.h"

-vtkCxxRevisionMacro(vtkBMPReader, "$Revision: 1.44 $");
+vtkCxxRevisionMacro(vtkBMPReader, "$Revision: 1.45 $");
  vtkStandardNewMacro(vtkBMPReader);

  #ifdef read
@@ -504,11 +504,11 @@
          outPtr0 += outIncr[0];
          }
        // move to the next row in the file and data
-      self->GetFile()->seekg(self->GetFile()->tellg() + streamSkip0, 
ios::beg);
+ 
self->GetFile()->seekg(static_cast<long>(self->GetFile()->tellg()) + 
streamSkip0, ios::beg);
        outPtr1 += outIncr[1];
        }
      // move to the next image in the file and data
-    self->GetFile()->seekg(self->GetFile()->tellg() + streamSkip1, 
ios::beg);
+    self->GetFile()->seekg(static_cast<long>(self->GetFile()->tellg()) 
+ streamSkip1, ios::beg);
      outPtr2 += outIncr[2];
      }

-- 
Martin







More information about the vtkusers mailing list