Subject: CGAL users discussion list
List archive
- From: Daisuke Sakurai <>
- To: , Philipp Moeller <>
- Subject: Re: [cgal-discuss] Bug in Inventor_ostream.h and VRML_2_ostream.h
- Date: Sun, 15 Dec 2013 10:53:40 +0900
Thank you so much for your help. No problem. Sorry that I have not included the error output in the report.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. I simplified the command, but it does essentially the same thing as the old one. (I just moved the source files to my user directory.)Or more specifically, the following command reproduces the problem $ /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 -ICGAL-4.3/include -isystem /opt/local/include -ICGAL-4.3/examples/Polyhedron_IO -o off2iv.cpp.o -c CGAL-4.3/examples/Polyhedron_IO/off2iv.cpp The output: In file included from CGAL-4.3/examples/Polyhedron_IO/off2iv.cpp:4: CGAL-4.3/include/CGAL/IO/Inventor_ostream.h:57:20: error: no viable conversion from 'std::ostream' (aka 'basic_ostream<char>') to 'Const_void_ptr' (aka 'const void *') return *m_os; ^~~~~ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/ios:576:9: note: candidate function operator bool() const {return !fail();} ^ 1 error generated. Sincerely, Daisuke Philipp Moeller wrote: 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.cppThanks 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 --
Daisuke Sakurai |
- [cgal-discuss] Bug in Inventor_ostream.h and VRML_2_ostream.h, Daisuke Sakurai, 12/13/2013
- Re: [cgal-discuss] Bug in Inventor_ostream.h and VRML_2_ostream.h, Philipp Moeller, 12/14/2013
- Re: [cgal-discuss] Bug in Inventor_ostream.h and VRML_2_ostream.h, Daisuke Sakurai, 12/15/2013
- Re: [cgal-discuss] Bug in Inventor_ostream.h and VRML_2_ostream.h, Philipp Moeller, 12/14/2013
Archive powered by MHonArc 2.6.18.