GCC 4.7 build issues: error: no matching function for call...
David Tardon
dtardon at redhat.com
Mon Jan 9 07:43:38 UTC 2012
On Fri, Jan 06, 2012 at 10:06:15AM -0600, Richard Shaw wrote:
> openCOLLADA is failing to build with GCC 4.7 in rawhide and I was
> hoping someone could point me in the right direction for a solution.
>
> Below is the build log snippet.
>
> Thanks,
> Richard
> ---
> In file included from
> /builddir/build/BUILD/openCOLLADA-svn864/COLLADAStreamWriter/include/COLLADASWTechniqueFX.h:17:0,
> from
> /builddir/build/BUILD/openCOLLADA-svn864/COLLADAStreamWriter/src/COLLADASWTechniqueFX.cpp:12:
> /builddir/build/BUILD/openCOLLADA-svn864/COLLADAStreamWriter/include/COLLADASWAnnotation.h:225:38:
> error: no matching function for call to
> 'COLLADASW::Annotation::openValuesElement(const
> COLLADASW::ValueType::ColladaType&) const'
^^^
It wants to call "openValuesElement() const" (which means that "this" is
const)...
> /builddir/build/BUILD/openCOLLADA-svn864/COLLADAStreamWriter/include/COLLADASWAnnotation.h:225:38:
> note: candidate is:
> In file included from
> /builddir/build/BUILD/openCOLLADA-svn864/COLLADAStreamWriter/include/COLLADASWTechniqueFX.h:17:0,
> from
> /builddir/build/BUILD/openCOLLADA-svn864/COLLADAStreamWriter/src/COLLADASWTechniqueFX.cpp:12:
> /builddir/build/BUILD/openCOLLADA-svn864/COLLADAStreamWriter/include/COLLADASWAnnotation.h:178:14:
> note: void COLLADASW::Annotation::openValuesElement(const
> COLLADASW::ValueType::ColladaType&) <near match>
... but only "openValuesElement()" is available...
> /builddir/build/BUILD/openCOLLADA-svn864/COLLADAStreamWriter/include/COLLADASWAnnotation.h:178:14:
> note: no known conversion for implicit 'this' parameter from 'const
> COLLADASW::Annotation*' to 'COLLADASW::Annotation*'
... and there is no known conversion to get rid of the constness.
If one looks at the source, it is immediately clear where the problem
is: the Annotation::add() template is const and tries to call non-const
members. But that is nothing new in gcc 4.7--I wonder how it ever
buit before... Anyway, the attached patch should fix it.
D.
-------------- next part --------------
diff -up COLLADAStreamWriter/include/COLLADASWAnnotation.h.old COLLADAStreamWriter/include/COLLADASWAnnotation.h
--- COLLADAStreamWriter/include/COLLADASWAnnotation.h.old 2012-01-09 08:30:38.456362609 +0100
+++ COLLADAStreamWriter/include/COLLADASWAnnotation.h 2012-01-09 08:30:43.233246290 +0100
@@ -219,7 +219,7 @@ namespace COLLADASW
void add (
const String &name,
const ValueType::ColladaType &type,
- const T val ) const
+ const T val )
{
openAnnotation ( name );
openValuesElement ( type );
More information about the devel
mailing list