Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Bug in Inventor_ostream.h and VRML_2_ostream.h

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Bug in Inventor_ostream.h and VRML_2_ostream.h


Chronological Thread 
  • From: Philipp Moeller <>
  • To: Daisuke Sakurai <>
  • Cc:
  • Subject: Re: [cgal-discuss] Bug in Inventor_ostream.h and VRML_2_ostream.h
  • Date: Sat, 14 Dec 2013 13:51:28 +0100
  • Organization: GeometryFactory

Daisuke Sakurai
<>
writes:

> I have found a possible bug in "Inventor_ostream.h" and "VRML_2_ostream.h".
> I believe that the attached patches fix the problem.
>
> Problem: some examples, which ship with CGAL 4.3, fail to compile.
> Each of the examples include at least one of the two .h files.
> In order to reproduce the bug for "Inventor_ostream.h", I simply need
> to compile the example,
> CGAL-4.3/examples/Polyhedron_IO/off2iv.cpp

Thanks for the patches, but I don't think they are right. After your
patches a non-null pointer will be returned even if the underlying
stream failed, which is clearly not what should happen.

I currently don't have access to Mac OS X 10.9 and the Apple clang, so I
cannot confirm this. Could you provide a the error output? I believe
this could be related to returning `const void*` instead of
`void*`. There has been a clang bug that rejected an overload when
const-ness has been involved.

>
> The compilations fail for the clang++ compiler, at least on my Mac OS
> X 10.9.
> To avoid the errors, I applied the following patches:
>
> -------
>
> --- CGAL-4.3/include/CGAL/IO/Inventor_ostream.h.orig 2013-12-13
> 18:03:44.000000000 +0900
> +++ CGAL-4.3/include/CGAL/IO/Inventor_ostream.h 2013-12-13
> 18:04:17.000000000 +0900
> @@ -54,7 +54,7 @@
> typedef const void* Const_void_ptr;
> operator Const_void_ptr () const {
> if ( m_os)
> - return *m_os;
> + return m_os;
> return 0;
> }
> #else
>
> ------
>
> --- CGAL-4.3/include/CGAL/IO/VRML_2_ostream.h.orig 2013-12-13
> 18:30:39.000000000 +0900
> +++ CGAL-4.3/include/CGAL/IO/VRML_2_ostream.h 2013-12-13
> 18:30:52.000000000 +0900
> @@ -48,7 +48,7 @@
> typedef const void* Const_void_ptr;
> operator Const_void_ptr () const {
> if ( m_os)
> - return *m_os;
> + return m_os;
> return 0;
> }
> #else
>
> ------
>
> It seems that removing the asterisks makes the compilation continue.
> However, I am not sure if this is the correct solution to the problem.
> I attach the patches to this email.
>
>
> Additional info:
>
> which operating system, compiler, and hardware you are using:
>
> Mac OS X 10.9
>
> /usr/bin/clang++
> Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
> Target: x86_64-apple-darwin13.0.0
> Thread model: posix
>
> Intel Core i7
>
>
> information about how CGAL was installed on your system (i.e., which
> options were used, how the library was built, etc.):
> I used macports.
> $ sudo port install cgal +demos +qt4 +universal
>
>
> a description of the problem or bug and a way to reproduce it (such as
> a small sample program or a sequence of commands):
> Again,
> $ sudo port install cgal +demos +qt4 +universal
>
> Or more specifically, the following command reproduces the problem
> (after the above command "port install cgal +demos +qt4 +universal"
> leaves failing source codes).
>
> $ sudo /usr/bin/clang++ -DCGAL_USE_GMP -DCGAL_USE_MPFR -pipe -Os
> -I/opt/local/include -arch x86_64 -arch i386 -DNDEBUG -arch x86_64
> -arch i386
> -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_gis_cgal/cgal/work/CGAL-4.3/examples/Polyhedron_IO/../../include
> -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_gis_cgal/cgal/work/CGAL-4.3/include
> -isystem /opt/local/include
> -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_gis_cgal/cgal/work/CGAL-4.3/examples/Polyhedron_IO
> -o CMakeFiles/off2iv.dir/off2iv.cpp.o -c
> /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_gis_cgal/cgal/work/CGAL-4.3/examples/Polyhedron_IO/off2iv.cpp



Archive powered by MHonArc 2.6.18.

Top of Page