Page 1 of 1

Incorrect C++ code in IM's header files

Posted: 2010-06-16T02:08:02-07:00
by jpa
I'm trying to use ImageMagick++ with the new clang++ compiler.

On Fedora 13 this program:

Code: Select all

#include<iostream>
#include<Magick++.h>
using namespace Magick;

int main(int argc, char **argv) {
  std::cout << "It compiled." << std::endl;
  return 0;
}
Gives this error when compiled with clang++:

Code: Select all

In file included from imbug.cpp:2:
In file included from /usr/include/ImageMagick/Magick++.h:12:
/usr/include/ImageMagick/Magick++/STL.h:2220:18: error: no viable overloaded
'='
    quantizeInfo = dither_ ? MagickCore::MagickTrue : MagickCore::MagickFalse;
    ~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from imbug.cpp:2:
In file included from /usr/include/ImageMagick/Magick++.h:9:
In file included from /usr/include/ImageMagick/Magick++/Include.h:47:
In file included from /usr/include/ImageMagick/magick/MagickCore.h:169:
In file included from /usr/include/ImageMagick/magick/deprecate.h:34:
/usr/include/ImageMagick/magick/quantize.h:35:16: note: candidate function (the
implicit copy assignment operator) not viable: no known conversion from
'MagickCore::MagickBooleanType' to 'MagickCore::_QuantizeInfo const' for 1st
argument
typedef struct _QuantizeInfo
I filed this as a bug in Clang's bug tracker but their response was that the definition of mapImages is invalid C++. See here for the actual discussion.

I used the latest clang from SVN. As far as I can remember, earlier versions of clang worked just fine.

Re: Incorrect C++ code in IM's header files

Posted: 2010-06-16T05:52:18-07:00
by magick
We can reproduce the problem and have a patch in ImageMagick 6.6.2-6 available by sometime tomorrow. Thanks.