After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 602408 - Invalid C++ code breaks compile with Sun C++ Compiler (Error: A union member cannot have a user-defined assignment operator)
Invalid C++ code breaks compile with Sun C++ Compiler (Error: A union member ...
Status: VERIFIED FIXED
Product: pango
Classification: Platform
Component: general
1.26.x
Other All
: Normal critical
: ---
Assigned To: pango-maint
pango-maint
Depends on:
Blocks:
 
 
Reported: 2009-11-19 13:54 UTC by rehsack
Modified: 2009-11-24 12:16 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description rehsack 2009-11-19 13:54:56 UTC
Hi there,

I tried to compile pango on Solaris 10 (as a dependency of vim-gtk2).
The compiler breaks compilation with:
        source='hb-ot-layout.cc' object='libharfbuzz_la-hb-ot-layout.lo' libtool=yes \
        DEPDIR=.deps depmode=none /opt/pkg/bin/pdksh ../../depcomp \
        /opt/pkg/bin/pdksh ../../libtool  --tag=CXX   --mode=compile CC -DHAVE_CONFIG_H -I. -I../..  -DHAVE_GLIB -D_REENTRANT -D_PTHREADS -I/opt/pkg/include/glib/glib-2.0 -I/opt/pkg/lib/glib-2.0/include   -DPNG_NO_ASSEMBLER_CODE -I/opt/pkg/include -I/usr/include -I/opt/pkg/include/freetype2  -m64 -O3 -I/opt/pkg/include -I/usr/include -I/opt/pkg/include/freetype2 -m64 -features=%all,no%except -c -o libharfbuzz_la-hb-ot-layout.lo `test -f 'hb-ot-layout.cc' || echo './'`hb-ot-layout.cc
 CC -DHAVE_CONFIG_H -I. -I../.. -DHAVE_GLIB -D_REENTRANT -D_PTHREADS -I/opt/pkgsrc/devel/pango/work/.buildlink/include/glib/glib-2.0 -I/opt/pkgsrc/devel/pango/work/.buildlink/lib/glib-2.0/include -DPNG_NO_ASSEMBLER_CODE -I/opt/pkgsrc/devel/pango/work/.buildlink/include -I/opt/pkgsrc/devel/pango/work/.buildlink/include/freetype2 -m64 -O3 -m64 -features=%all,no%except -c hb-ot-layout.cc  -KPIC -DPIC -o .libs/libharfbuzz_la-hb-ot-layout.o
"hb-ot-layout-common-private.hh", line 426: Error: A union member cannot have a user-defined assignment operator.
"hb-ot-layout-common-private.hh", line 427: Error: A union member cannot have a user-defined assignment operator.
"hb-ot-layout-common-private.hh", line 428: Error: A union member cannot have a user-defined assignment operator.
"hb-ot-layout-common-private.hh", line 427: Error: In this declaration "format1" is of an incomplete type "CoverageFormat1[]".
"hb-ot-layout-common-private.hh", line 542: Error: A union member cannot have a user-defined assignment operator.
"hb-ot-layout-common-private.hh", line 543: Error: A union member cannot have a user-defined assignment operator.
"hb-ot-layout-common-private.hh", line 544: Error: A union member cannot have a user-defined assignment operator.
"hb-ot-layout-common-private.hh", line 543: Error: In this declaration "format1" is of an incomplete type "ClassDefFormat1[]".
"hb-ot-layout-gdef-private.hh", line 179: Error: A union member cannot have a user-defined assignment operator.
"hb-ot-layout-gdef-private.hh", line 180: Error: A union member cannot have a user-defined assignment operator.
"hb-ot-layout-gdef-private.hh", line 181: Error: A union member cannot have a user-defined assignment operator.
"hb-ot-layout-gdef-private.hh", line 182: Error: A union member cannot have a user-defined assignment operator.
"hb-ot-layout-gdef-private.hh", line 180: Error: In this declaration "format1" is of an incomplete type "CaretValueFormat1[]".
"hb-ot-layout-gdef-private.hh", line 181: Error: In this declaration "format2" is of an incomplete type "CaretValueFormat2[]".
"hb-ot-layout-gdef-private.hh", line 288: Error: A union member cannot have a user-defined assignment operator.
"hb-ot-layout-gdef-private.hh", line 289: Error: A union member cannot have a user-defined assignment operator.
"hb-ot-layout-gsubgpos-private.hh", line 321: Error: In this declaration "input" is of an incomplete type "USHORT[]".
"hb-ot-layout-gsubgpos-private.hh", line 476: Error: In this declaration "coverage" is of an incomplete type "OffsetTo<Coverage>[]".
"hb-ot-layout-gsubgpos-private.hh", line 510: Error: A union member cannot have a user-defined assignment operator.
"hb-ot-layout-gsubgpos-private.hh", line 511: Error: A union member cannot have a user-defined assignment operator.
"hb-ot-layout-gsubgpos-private.hh", line 512: Error: A union member cannot have a user-defined assignment operator.
"hb-ot-layout-gsubgpos-private.hh", line 513: Error: A union member cannot have a user-defined assignment operator.
"hb-ot-layout-gsubgpos-private.hh", line 511: Error: In this declaration "format1" is of an incomplete type "ContextFormat1[]".
"hb-ot-layout-gsubgpos-private.hh", line 512: Error: In this declaration "format2" is of an incomplete type "ContextFormat2[]".
"hb-ot-layout-gsubgpos-private.hh", line 823: Error: A union member cannot have a user-defined assignment operator.
Compilation aborted, too many Error messages.
gmake[4]: *** [libharfbuzz_la-hb-ot-layout.lo] Error 1
gmake[4]: Leaving directory `/opt/pkgsrc/devel/pango/work/pango-1.26.0/pango/opentype'

First I thought - maybe as a workaround the assignment operator could be replaced by a copy constructor, but it couldn't. Than I took a look into the Bible (C++ Programming Language by Bjarne Stroustrup): Chapter 10.4.12 forbids explicitly using of union members with constructors, destructors or assignment operations.

That's why I choose 'All' for OS - it doesn't matter, it violates C++ rules.
You might find http://defect.opensolaris.org/bz/show_bug.cgi?id=10895 interesting, too.
Comment 1 Behdad Esfahbod 2009-11-20 22:35:13 UTC
Fixed in master.  Please test.

commit 27b2a4a4d504d6ba06b8acd91eab17796bc3b3c8
Author: Behdad Esfahbod <behdad@behdad.org>
Date:   Thu Nov 19 20:35:07 2009 -0500

    Another C++ strictness fix
    
    Pango Bug 602408 - Invalid C++ code breaks compile with Sun C++ Compiler
    (Error: A union member cannot have a user-defined assignment operator)
    
    According to the bug:
    
    C++ Programming Language by Bjarne Stroustrup: Chapter 10.4.12 forbids
    explicitly using of union members with constructors, destructors or assignment
    operations.
    
    So we use a set() method instead of the assignment operator.  Ugly, but hey,
    that's life.
    
    Cherry-pick from harfbuzz-ng repo.
Comment 2 rehsack 2009-11-22 19:02:09 UTC
The problem is only partial solved:
/opt/sunstudio12.1/bin/CC -DHAVE_CONFIG_H -I. -I../.. -DHAVE_GLIB -D_REENTRANT -D_PTHREADS -I/usr/pkgsrc/devel/pango/work/.buildlink/include/glib/glib-2.0 -I/usr/pkgsrc/devel/pango/work/.buildlink/lib/glib-2.0/include -I/usr/pkgsrc/devel/pango/work/.buildlink/include -I/usr/pkgsrc/devel/pango/work/.buildlink/include/freetype2 -O -xarch=native -xarch=sse3 -features=%all,no%except -c hb-ot-layout.cc -KPIC -DPIC -o .libs/libharfbuzz_la-hb-ot-layout.o -m64 -L/usr/pkgsrc/devel/pango/work/.buildlink/lib +w
"hb-open-type-private.hh", line 376: Warning: Conversion of 64 bit type value to "unsigned" causes truncation.
"hb-open-type-private.hh", line 377: Warning: Conversion of 64 bit type value to "unsigned" causes truncation.
"hb-open-type-private.hh", line 378: Warning: Conversion of 64 bit type value to "unsigned" causes truncation.
"hb-open-type-private.hh", line 379: Warning: Conversion of 64 bit type value to "unsigned" causes truncation.
"hb-open-type-private.hh", line 400: Warning: Conversion of 64 bit type value to "unsigned" causes truncation.
"hb-open-type-private.hh", line 444: Warning: Conversion of 64 bit type value to "unsigned" causes truncation.
"hb-ot-layout-common-private.hh", line 159: Warning: Conversion of 64 bit type value to "unsigned" causes truncation.
"hb-ot-layout-common-private.hh", line 223: Warning: Conversion of 64 bit type value to "unsigned" causes truncation.
"hb-ot-layout-common-private.hh", line 259: Warning: Conversion of 64 bit type value to "unsigned" causes truncation.
"hb-ot-layout-common-private.hh", line 286: Warning: Conversion of 64 bit type value to "unsigned" causes truncation.
"hb-ot-layout-common-private.hh", line 359: Warning: Conversion of 64 bit type value to "unsigned" causes truncation.
"hb-ot-layout-common-private.hh", line 428: Error: In this declaration "format1" is of an incomplete type "CoverageFormat1[]".
"hb-ot-layout-common-private.hh", line 453: Warning: Conversion of 64 bit type value to "unsigned" causes truncation.
"hb-ot-layout-common-private.hh", line 478: Warning: Conversion of 64 bit type value to "unsigned" causes truncation.
"hb-ot-layout-common-private.hh", line 544: Error: In this declaration "format1" is of an incomplete type "ClassDefFormat1[]".
"hb-ot-layout-common-private.hh", line 585: Warning: Conversion of 64 bit type value to "unsigned" causes truncation.
"hb-ot-layout-common-private.hh", line 586: Warning: Conversion of 64 bit type value to "unsigned" causes truncation.
"hb-ot-layout-common-private.hh", line 591: Warning: Conversion of 64 bit type value to "unsigned" causes truncation.
"hb-ot-layout-gdef-private.hh", line 98: Warning: Conversion of 64 bit type value to "unsigned" causes truncation.
"hb-ot-layout-gdef-private.hh", line 119: Warning: Conversion of 64 bit type value to "unsigned" causes truncation.
"hb-ot-layout-gdef-private.hh", line 141: Warning: Conversion of 64 bit type value to "unsigned" causes truncation.
"hb-ot-layout-gdef-private.hh", line 180: Error: In this declaration "format1" is of an incomplete type "CaretValueFormat1[]".
"hb-ot-layout-gdef-private.hh", line 181: Error: In this declaration "format2" is of an incomplete type "CaretValueFormat2[]".
"hb-ot-layout-gsubgpos-private.hh", line 200: Warning: Conversion of 64 bit type value to "unsigned" causes truncation.
"hb-ot-layout-gsubgpos-private.hh", line 321: Error: In this declaration "input" is of an incomplete type "USHORT[]".
"hb-ot-layout-gsubgpos-private.hh", line 310: Warning: Conversion of 64 bit type value to "unsigned" causes truncation.
"hb-ot-layout-gsubgpos-private.hh", line 313: Warning: Conversion of 64 bit type value to "unsigned" causes truncation.
"hb-ot-layout-gsubgpos-private.hh", line 476: Error: In this declaration "coverage" is of an incomplete type "OffsetTo<Coverage>[]".
"hb-ot-layout-gsubgpos-private.hh", line 462: Warning: Conversion of 64 bit type value to "unsigned" causes truncation.
"hb-ot-layout-gsubgpos-private.hh", line 467: Warning: Conversion of 64 bit type value to "unsigned" causes truncation.
"hb-ot-layout-gsubgpos-private.hh", line 511: Error: In this declaration "format1" is of an incomplete type "ContextFormat1[]".
"hb-ot-layout-gsubgpos-private.hh", line 512: Error: In this declaration "format2" is of an incomplete type "ContextFormat2[]".
"hb-ot-layout-gsubgpos-private.hh", line 824: Error: In this declaration "format1" is of an incomplete type "ChainContextFormat1[]".
"hb-ot-layout-gsubgpos-private.hh", line 825: Error: In this declaration "format2" is of an incomplete type "ChainContextFormat2[]".
"hb-ot-layout-gsubgpos-private.hh", line 848: Warning: Conversion of 64 bit type value to "unsigned" causes truncation.
"hb-ot-layout-gsub-private.hh", line 144: Error: In this declaration "format1" is of an incomplete type "SingleSubstFormat1[]".
"hb-ot-layout-gsub-private.hh", line 736: Error: In this declaration "single" is of an incomplete type "SingleSubst[]".
"hb-ot-layout-gsub-private.hh", line 737: Error: In this declaration "multiple" is of an incomplete type "MultipleSubst[]".
"hb-ot-layout-gsub-private.hh", line 738: Error: In this declaration "alternate" is of an incomplete type "AlternateSubst[]".
"hb-ot-layout-gsub-private.hh", line 739: Error: In this declaration "ligature" is of an incomplete type "LigatureSubst[]".
"hb-ot-layout-gsub-private.hh", line 740: Error: In this declaration "context" is of an incomplete type "ContextSubst[]".
"hb-ot-layout-gsub-private.hh", line 741: Error: In this declaration "chainContext" is of an incomplete type "ChainContextSubst[]".
"hb-ot-layout-gsub-private.hh", line 742: Error: In this declaration "extension" is of an incomplete type "ExtensionSubst[]".
"hb-ot-layout-gpos-private.hh", line 60: Warning: Conversion of 64 bit type value to "unsigned" causes truncation.
"hb-ot-layout-gpos-private.hh", line 155: Warning: Conversion of 64 bit type value to "int" causes truncation.
"hb-ot-layout-gpos-private.hh", line 156: Warning: Conversion of 64 bit type value to "int" causes truncation.
"hb-ot-layout-gpos-private.hh", line 161: Warning: Conversion of 64 bit type value to "unsigned" causes truncation.
"hb-ot-layout-gpos-private.hh", line 180: Warning: Conversion of 64 bit type value to "int" causes truncation.
"hb-ot-layout-gpos-private.hh", line 181: Warning: Conversion of 64 bit type value to "int" causes truncation.
"hb-ot-layout-gpos-private.hh", line 186: Warning: Conversion of 64 bit type value to "unsigned" causes truncation.
"hb-ot-layout-gpos-private.hh", line 205: Warning: Conversion of 64 bit type value to "int" causes truncation.
"hb-ot-layout-gpos-private.hh", line 206: Warning: Conversion of 64 bit type value to "int" causes truncation.
"hb-ot-layout-gpos-private.hh", line 216: Warning: Conversion of 64 bit type value to "unsigned" causes truncation.
"hb-ot-layout-gpos-private.hh", line 262: Error: In this declaration "format1" is of an incomplete type "AnchorFormat1[]".
"hb-ot-layout-gpos-private.hh", line 263: Error: In this declaration "format2" is of an incomplete type "AnchorFormat2[]".
"hb-ot-layout-gpos-private.hh", line 279: Warning: Conversion of 64 bit type value to "unsigned" causes truncation.
"hb-ot-layout-gpos-private.hh", line 281: Warning: Conversion of 64 bit type value to "unsigned" causes truncation.
"hb-ot-layout-gpos-private.hh", line 302: Warning: Conversion of 64 bit type value to "unsigned" causes truncation.
"hb-ot-layout-gpos-private.hh", line 378: Warning: Conversion of 64 bit type value to "unsigned" causes truncation.
"hb-ot-layout-gpos-private.hh", line 420: Warning: Conversion of 64 bit type value to "unsigned" causes truncation.
"hb-ot-layout-gpos-private.hh", line 464: Error: In this declaration "format1" is of an incomplete type "SinglePosFormat1[]".
"hb-ot-layout-gpos-private.hh", line 490: Warning: Conversion of 64 bit type value to "unsigned" causes truncation.
"hb-ot-layout-gpos-private.hh", line 492: Warning: Conversion of 64 bit type value to "unsigned" causes truncation.
"hb-ot-layout-gpos-private.hh", line 556: Warning: Conversion of 64 bit type value to "unsigned" causes truncation.
"hb-ot-layout-gpos-private.hh", line 623: Warning: Conversion of 64 bit type value to "unsigned" causes truncation.
"hb-ot-layout-gpos-private.hh", line 687: Error: In this declaration "format1" is of an incomplete type "PairPosFormat1[]".
"hb-ot-layout-gpos-private.hh", line 983: Warning: Conversion of 64 bit type value to "unsigned" causes truncation.
"hb-ot-layout-gpos-private.hh", line 1107: Warning: Conversion of 64 bit type value to "unsigned" causes truncation.
"hb-ot-layout-gpos-private.hh", line 1207: Warning: Conversion of 64 bit type value to "unsigned" causes truncation.
"hb-ot-layout-gpos-private.hh", line 1365: Error: In this declaration "single" is of an incomplete type "SinglePos[]".
"hb-ot-layout-gpos-private.hh", line 1366: Error: In this declaration "pair" is of an incomplete type "PairPos[]".
"hb-ot-layout-gpos-private.hh", line 1367: Error: In this declaration "cursive" is of an incomplete type "CursivePos[]".
Compilation aborted, too many Error messages.
Comment 3 rehsack 2009-11-22 19:04:23 UTC
Compiled again without -features=%all may give additional hints:
/opt/sunstudio12.1/bin/CC -DHAVE_CONFIG_H -I. -I../.. -DHAVE_GLIB -D_REENTRANT -D_PTHREADS -I/usr/pkgsrc/devel/pango/work/.buildlink/include/glib/glib-2.0 -I/usr/pkgsrc/devel/pango/work/.buildlink/lib/glib-2.0/include -I/usr/pkgsrc/devel/pango/work/.buildlink/include -I/usr/pkgsrc/devel/pango/work/.buildlink/include/freetype2 -O -xarch=native -xarch=sse3 -c hb-ot-layout.cc -KPIC -DPIC -o .libs/libharfbuzz_la-hb-ot-layout.o -m64 -L/usr/pkgsrc/devel/pango/work/.buildlink/lib
"hb-open-type-private.hh", line 559: Error: In this declaration "array" is of an incomplete type "USHORT[]".
"hb-open-type-private.hh", line 564:     Where: While specializing "GenericArrayOf<USHORT, USHORT>".
"hb-open-type-private.hh", line 564:     Where: Specialized in ArrayOf<USHORT>.
"hb-ot-layout-common-private.hh", line 114:     Where: Specialized in non-template code.
"hb-ot-layout-common-private.hh", line 119: Error: Pointer type needed instead of const int.
"hb-ot-layout-common-private.hh", line 126: Error: Pointer type needed instead of const int.
"hb-ot-layout-common-private.hh", line 169: Error: The size in an array declaration cannot be negative.
"hb-open-type-private.hh", line 559: Error: In this declaration "array" is of an incomplete type "Record<LangSys>[]".
"hb-open-type-private.hh", line 564:     Where: While specializing "GenericArrayOf<USHORT, Record<LangSys>>".
"hb-open-type-private.hh", line 564:     Where: Specialized in ArrayOf<Record<LangSys>>.
"hb-ot-layout-common-private.hh", line 66:     Where: Specialized in RecordArrayOf<LangSys>.
"hb-ot-layout-common-private.hh", line 202:     Where: Specialized in non-template code.
"hb-ot-layout-common-private.hh", line 205: Error: The size in an array declaration cannot be negative.
"hb-open-type-private.hh", line 559: Error: In this declaration "array" is of an incomplete type "Record<Script>[]".
"hb-open-type-private.hh", line 564:     Where: While specializing "GenericArrayOf<USHORT, Record<Script>>".
"hb-open-type-private.hh", line 564:     Where: Specialized in ArrayOf<Record<Script>>.
"hb-ot-layout-common-private.hh", line 66:     Where: Specialized in RecordArrayOf<Script>.
"hb-ot-layout-common-private.hh", line 102:     Where: Specialized in RecordListOf<Script>.
"hb-ot-layout-common-private.hh", line 208:     Where: Specialized in non-template code.
"hb-ot-layout-common-private.hh", line 208: Error: The size in an array declaration cannot be negative.
"hb-ot-layout-common-private.hh", line 234: Error: The size in an array declaration cannot be negative.
"hb-open-type-private.hh", line 559: Error: In this declaration "array" is of an incomplete type "Record<Feature>[]".
"hb-open-type-private.hh", line 564:     Where: While specializing "GenericArrayOf<USHORT, Record<Feature>>".
"hb-open-type-private.hh", line 564:     Where: Specialized in ArrayOf<Record<Feature>>.
"hb-ot-layout-common-private.hh", line 66:     Where: Specialized in RecordArrayOf<Feature>.
"hb-ot-layout-common-private.hh", line 102:     Where: Specialized in RecordListOf<Feature>.
"hb-ot-layout-common-private.hh", line 237:     Where: Specialized in non-template code.
"hb-ot-layout-common-private.hh", line 237: Error: The size in an array declaration cannot be negative.
"hb-open-type-private.hh", line 559: Error: In this declaration "array" is of an incomplete type "OffsetTo<LookupSubTable>[]".
"hb-open-type-private.hh", line 564:     Where: While specializing "GenericArrayOf<USHORT, OffsetTo<LookupSubTable>>".
"hb-open-type-private.hh", line 564:     Where: Specialized in ArrayOf<OffsetTo<LookupSubTable>>.
"hb-open-type-private.hh", line 572:     Where: Specialized in OffsetArrayOf<LookupSubTable>.
"hb-ot-layout-common-private.hh", line 298:     Where: Specialized in non-template code.
"hb-ot-layout-common-private.hh", line 299: Error: An array cannot have zero size unless you use the option -features=zla.
"hb-ot-layout-common-private.hh", line 303: Error: The size in an array declaration cannot be negative.
"hb-open-type-private.hh", line 559: Error: In this declaration "array" is of an incomplete type "OffsetTo<Lookup>[]".
"hb-open-type-private.hh", line 564:     Where: While specializing "GenericArrayOf<USHORT, OffsetTo<Lookup>>".
"hb-open-type-private.hh", line 564:     Where: Specialized in ArrayOf<OffsetTo<Lookup>>.
"hb-open-type-private.hh", line 572:     Where: Specialized in OffsetArrayOf<Lookup>.
"hb-open-type-private.hh", line 585:     Where: Specialized in OffsetListOf<Lookup>.
"hb-ot-layout-common-private.hh", line 306:     Where: Specialized in non-template code.
"hb-ot-layout-common-private.hh", line 306: Error: The size in an array declaration cannot be negative.
"hb-ot-layout-common-private.hh", line 342: Error: The size in an array declaration cannot be negative.
"hb-open-type-private.hh", line 559: Error: In this declaration "array" is of an incomplete type "CoverageRangeRecord[]".
"hb-open-type-private.hh", line 564:     Where: While specializing "GenericArrayOf<USHORT, CoverageRangeRecord>".
"hb-open-type-private.hh", line 564:     Where: Specialized in ArrayOf<CoverageRangeRecord>.
"hb-ot-layout-common-private.hh", line 396:     Where: Specialized in non-template code.
"hb-ot-layout-common-private.hh", line 400: Error: The size in an array declaration cannot be negative.
"hb-ot-layout-common-private.hh", line 428: Error: In this declaration "format1" is of an incomplete type "CoverageFormat1[]".
"hb-ot-layout-common-private.hh", line 429: Error: In this declaration "format2" is of an incomplete type "CoverageFormat2[]".
"hb-ot-layout-common-private.hh", line 409: Error: Pointer type needed instead of const int.
"hb-ot-layout-common-private.hh", line 410: Error: Pointer type needed instead of const int.
"hb-ot-layout-common-private.hh", line 419: Error: Pointer type needed instead of int.
"hb-ot-layout-common-private.hh", line 420: Error: Pointer type needed instead of int.
Compilation aborted, too many Error messages.
Comment 4 Behdad Esfahbod 2009-11-22 19:13:45 UTC
That's a separate issue.  Filed bug 602660 for that.
Comment 5 rehsack 2009-11-24 12:16:38 UTC
Confirmed fixed