Another issue with the SunStudio compiler

Alexander Neundorf neundorf at kde.org
Sat Dec 19 15:18:30 CET 2009


On Friday 18 December 2009, Pavel Heimlich, a.k.a. hajma wrote:
> 2009/12/18 Alexander Neundorf <neundorf at kde.org>:
> > Hi,
> >
> > in kdelibs, khtml, there is another SunStudio compiler error:
> > http://my.cdash.org/viewBuildError.php?buildid=41969:
> >
> > "/.../srcdir/khtml/xml/dom_elementimpl.h", line 135: Error: Different
> > types for "?:" (DOM::DOMStringImpl*const and bool).
> >
> > This is line 135:
> >  DOMStringImpl *val() const { return m_localName.id() ? m_data.value :
> >                                                        
> > m_data.attr->val(); }
> >
> >
> > m_data.value is a DOMStringImpl:
> >
> >    union {
> >        DOMStringImpl *value;
> >        AttrImpl *attr;
> >    } m_data;
> >
> >
> > and AttrImpl::val() also returns a DOMStringImpl* :
> >
> > class AttrImpl : public NodeBaseImpl
> > {
> > ...
> >    DOMStringImpl *val() { return m_value; }
> >
> >
> > So, what does the compiler consider a bool here ?
>
> Hi Alex,
> the difference is in the const.
> we have a patch for that, at https://bugs.kde.org/show_bug.cgi?id=191750
> afaik made by adriaan.


--- ./khtml/xml/dom_elementimpl.h.orig	2009-04-19 23:04:53.155778487 +0200
+++ ./khtml/xml/dom_elementimpl.h	2009-04-19 23:09:48.844775656 +0200
@@ -111,6 +111,7 @@
 
     void setElement(ElementImpl *element);
     DOMStringImpl *val() { return m_value; }
+    DOMStringImpl *val_const() const { return m_value; }
 
Does it also work if you name the const-version also simply "val()" instead 
of "val_const()" ?

If so, I'd say it should be fine to commit it.

Alex



More information about the Kde-buildsystem mailing list