Opened 12 years ago
Closed 10 years ago
#37877 closed defect (fixed)
scantailor fails to build with clang-3.4 due to friend declaration bugs
Reported by: | ryandesign (Ryan Carsten Schmidt) | Owned by: | raphael-st (Raphael Straub) |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | ports | Version: | 2.1.2 |
Keywords: | Cc: | jeremyhu (Jeremy Huddleston Sequoia) | |
Port: | scantailor clang-3.4 |
Description
Jeremy asked in r102283 how scantailor failed to build with clang. This ticket is to document that failure. The attached log is from Xcode 4.6 on OS X 10.8.2 Mountain Lion.
In file included from /opt/local/var/macports/build/_Users_rschmidt_macports_dports_graphics_scantailor/scantailor/work/scantailor-0.9.11.1/dewarping/DistortionModelBuilder.cpp:21: In file included from /opt/local/var/macports/build/_Users_rschmidt_macports_dports_graphics_scantailor/scantailor/work/scantailor-0.9.11.1/dewarping/CylindricalSurfaceDewarper.h:22: In file included from /opt/local/var/macports/build/_Users_rschmidt_macports_dports_graphics_scantailor/scantailor/work/scantailor-0.9.11.1/math/HomographicTransform.h:23: /opt/local/var/macports/build/_Users_rschmidt_macports_dports_graphics_scantailor/scantailor/work/scantailor-0.9.11.1/math/MatrixCalc.h:127:10: error: calling a private constructor of class 'mcalc::Mat<double>' return mcalc::Mat<T>(&m_alloc, data, rows, cols); ^ /opt/local/var/macports/build/_Users_rschmidt_macports_dports_graphics_scantailor/scantailor/work/scantailor-0.9.11.1/dewarping/DistortionModelBuilder.cpp:516:5: note: in instantiation of member function 'MatrixCalc<double, mcalc::DynamicPoolAllocator<double> >::operator()' requested here mc(&At[0], 2, polyline_size).transWrite(&A[0]); ^ /opt/local/var/macports/build/_Users_rschmidt_macports_dports_graphics_scantailor/scantailor/work/scantailor-0.9.11.1/math/MatrixCalc.h:107:2: note: declared private here Mat(AbstractAllocator<T>* alloc, T const* data, int rows, int cols) ^ 1 error generated.
Attachments (1)
Change History (11)
Changed 12 years ago by ryandesign (Ryan Carsten Schmidt)
Attachment: | main.log.bz2 added |
---|
comment:1 follow-up: 3 Changed 12 years ago by jeremyhu (Jeremy Huddleston Sequoia)
comment:2 Changed 12 years ago by jmroot (Joshua Root)
Owner: | changed from macports-tickets@… to raphael@… |
---|
comment:3 Changed 12 years ago by raphael-st (Raphael Straub)
Replying to jeremyhu@…:
Ok, then this looks like a project bug. Those should probably not be private.
But, there is a friend declaration in class Mat
in math/MatrixCalc.h
:
template<typename T> class Mat { template<typename OT, typename Alloc> friend class MatrixCalc; [...] private: Mat(AbstractAllocator<T>* alloc, T const* data, int rows, int cols) : alloc(alloc), data(data), rows(rows), cols(cols) {} [...] }; [...] template<typename T, typename Alloc = mcalc::StaticPoolAllocator<T, 128, 9> > class MatrixCalc { [...] public: MatrixCalc() {} mcalc::Mat<T> operator()(T const* data, int rows, int cols) { return mcalc::Mat<T>(&m_alloc, data, rows, cols); } [...] };
This looks OK to me and also to gcc. Is this one of the bugs concerning friend declarations in clang?
comment:4 Changed 10 years ago by Martin.vGagern@…
See also #46014: macports-clang-3.4 causes this failure as well.
comment:5 Changed 10 years ago by jeremyhu (Jeremy Huddleston Sequoia)
Summary: | scantailor: build fails with clang → scantailor fails to build with clang-3.4 due to friend declaration bugs |
---|
comment:6 Changed 10 years ago by jeremyhu (Jeremy Huddleston Sequoia)
Port: | clang-3.4 added |
---|
comment:7 Changed 10 years ago by jeremyhu (Jeremy Huddleston Sequoia)
Could you please attach preprocessed source for the failing DistortionModelBuilder.cpp or provide a reduced test case?
comment:8 Changed 10 years ago by Martin.vGagern@…
Upstream commit 123a71a has a fix. The problem is the namespace: Mat
is in the mcalc
namespace while MatrixCalc
is in the global namespace, so the friend declaration should go ::MatrixCalc
. I managed to successfully build the current upstream master (6475756) using Apple LLVM version 5.1 (clang-503.0.38) (based on LLVM 3.4svn).
comment:9 Changed 10 years ago by jeremyhu (Jeremy Huddleston Sequoia)
Ah, ok. thanks. I was heading back to thinking this was a compiler bug, but I'm glad to see it is a project bug and with a fix too! qt4-mac is in the middle of compile here, but I suspect it'll finish up sometime tomorrow to allow me to test the change and commit if someone else doesn't beat me to it.
comment:10 Changed 10 years ago by jeremyhu (Jeremy Huddleston Sequoia)
Resolution: | → fixed |
---|---|
Status: | new → closed |
Ok, then this looks like a project bug. Those should probably not be private.