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 85978 - ambiguity error in drwabale.cc(g) with Sun Forte C++
ambiguity error in drwabale.cc(g) with Sun Forte C++
Status: RESOLVED FIXED
Product: gtkmm
Classification: Bindings
Component: build
2.0
Other Solaris
: Normal normal
: ---
Assigned To: gtkmm-forge
gtkmm-forge
: 89451 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2002-06-19 20:50 UTC by Michael v. Szombathely
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patches to prevent ambiguity error with Sun's Forte C++ compiler (8.42 KB, patch)
2002-07-30 22:15 UTC, Michael v. Szombathely
none Details | Review

Description Michael v. Szombathely 2002-06-19 20:50:48 UTC
Compiling gdk/gdkmm/drawable.cc from gtkmm-1.3.16 with Sun Forte C++ (WS6U2
aka 5.3) results in ambiguity errors around Glib::unwrap:

"drawable.cc", line 36: Error: Overloading ambiguity between
"Glib::unwrap<Gdk::GC>(const Glib::RefPtr<const Gdk::GC>&)" and
"Glib::unwrap<const Gdk::GC>(const Glib::RefPtr<const Gdk::GC>&)".
"drawable.cc", line 45: Error: Overloading ambiguity between
"Glib::unwrap<Gdk::GC>(const Glib::RefPtr<const Gdk::GC>&)" and
"Glib::unwrap<const Gdk::GC>(const Glib::RefPtr<const Gdk::GC>&)".
"drawable.cc", line 55: Error: Overloading ambiguity between
"Glib::unwrap<Gdk::GC>(const Glib::RefPtr<const Gdk::GC>&)" and
"Glib::unwrap<const Gdk::GC>(const Glib::RefPtr<const Gdk::GC>&)".
"drawable.cc", line 97: Warning (Anachronism): Assigning
void(*)(void*,void*) to extern "C" void(*)(void*,void*).
"drawable.cc", line 203: Error: Overloading ambiguity between
"Glib::unwrap<Gdk::GC>(const Glib::RefPtr<const Gdk::GC>&)" and
"Glib::unwrap<const Gdk::GC>(const Glib::RefPtr<const Gdk::GC>&)".
"drawable.cc", line 208: Error: Overloading ambiguity between
"Glib::unwrap<Gdk::GC>(const Glib::RefPtr<const Gdk::GC>&)" and
"Glib::unwrap<const Gdk::GC>(const Glib::RefPtr<const Gdk::GC>&)".
"drawable.cc", line 213: Error: Overloading ambiguity between
"Glib::unwrap<Gdk::GC>(const Glib::RefPtr<const Gdk::GC>&)" and
"Glib::unwrap<const Gdk::GC>(const Glib::RefPtr<const Gdk::GC>&)".
"drawable.cc", line 218: Error: Overloading ambiguity between
"Glib::unwrap<Gdk::GC>(const Glib::RefPtr<const Gdk::GC>&)" and
"Glib::unwrap<const Gdk::GC>(const Glib::RefPtr<const Gdk::GC>&)".
"drawable.cc", line 223: Error: Overloading ambiguity between
"Glib::unwrap<Gdk::GC>(const Glib::RefPtr<const Gdk::GC>&)" and
"Glib::unwrap<const Gdk::GC>(const Glib::RefPtr<const Gdk::GC>&)".
"drawable.cc", line 223: Error: Overloading ambiguity between
"Glib::unwrap<Gdk::Drawable>(const Glib::RefPtr<const Gdk::Drawable>&)" and
"Glib::unwrap<const Gdk::Drawable>(const Glib::RefPtr<const
Gdk::Drawable>&)".
"drawable.cc", line 228: Error: Overloading ambiguity between
"Glib::unwrap<Gdk::GC>(const Glib::RefPtr<const Gdk::GC>&)" and
"Glib::unwrap<const Gdk::GC>(const Glib::RefPtr<const Gdk::GC>&)".
"drawable.cc", line 228: Error: Overloading ambiguity between
"Glib::unwrap<Gdk::Image>(const Glib::RefPtr<const Gdk::Image>&)" and
"Glib::unwrap<const Gdk::Image>(const Glib::RefPtr<const Gdk::Image>&)".
"drawable.cc", line 233: Error: Overloading ambiguity between
"Glib::unwrap<Gdk::GC>(const Glib::RefPtr<const Gdk::GC>&)" and
"Glib::unwrap<const Gdk::GC>(const Glib::RefPtr<const Gdk::GC>&)".
"drawable.cc", line 238: Error: Overloading ambiguity between
"Glib::unwrap<Gdk::GC>(const Glib::RefPtr<const Gdk::GC>&)" and
"Glib::unwrap<const Gdk::GC>(const Glib::RefPtr<const Gdk::GC>&)".
"drawable.cc", line 238: Error: Overloading ambiguity between
"Glib::unwrap<Pango::Font>(const Glib::RefPtr<const Pango::Font>&)" and
"Glib::unwrap<const Pango::Font>(const Glib::RefPtr<const Pango::Font>&)".
"drawable.cc", line 243: Error: Overloading ambiguity between
"Glib::unwrap<Gdk::GC>(const Glib::RefPtr<const Gdk::GC>&)" and
"Glib::unwrap<const Gdk::GC>(const Glib::RefPtr<const Gdk::GC>&)".
"drawable.cc", line 243: Error: Overloading ambiguity between
"Glib::unwrap<Pango::LayoutLine>(const Glib::RefPtr<const
Pango::LayoutLine>&)" and "Glib::unwrap<const Pango::LayoutLine>(const
Glib::RefPtr<const Pango::LayoutLine>&)".
"drawable.cc", line 248: Error: Overloading ambiguity between
"Glib::unwrap<Gdk::GC>(const Glib::RefPtr<const Gdk::GC>&)" and
"Glib::unwrap<const Gdk::GC>(const Glib::RefPtr<const Gdk::GC>&)".
"drawable.cc", line 248: Error: Overloading ambiguity between
"Glib::unwrap<Pango::LayoutLine>(const Glib::RefPtr<const
Pango::LayoutLine>&)" and "Glib::unwrap<const Pango::LayoutLine>(const
Glib::RefPtr<const Pango::LayoutLine>&)".
"drawable.cc", line 253: Error: Overloading ambiguity between
"Glib::unwrap<Gdk::GC>(const Glib::RefPtr<const Gdk::GC>&)" and
"Glib::unwrap<const Gdk::GC>(const Glib::RefPtr<const Gdk::GC>&)".
"drawable.cc", line 253: Error: Overloading ambiguity between
"Glib::unwrap<Pango::Layout>(const Glib::RefPtr<const Pango::Layout>&)" and
"Glib::unwrap<const Pango::Layout>(const Glib::RefPtr<const
Pango::Layout>&)".
"drawable.cc", line 258: Error: Overloading ambiguity between
"Glib::unwrap<Gdk::GC>(const Glib::RefPtr<const Gdk::GC>&)" and
"Glib::unwrap<const Gdk::GC>(const Glib::RefPtr<const Gdk::GC>&)".
"drawable.cc", line 258: Error: Overloading ambiguity between
"Glib::unwrap<Pango::Layout>(const Glib::RefPtr<const Pango::Layout>&)" and
"Glib::unwrap<const Pango::Layout>(const Glib::RefPtr<const
Pango::Layout>&)".
"drawable.cc", line 278: Error: Overloading ambiguity between
"Glib::unwrap<Gdk::GC>(const Glib::RefPtr<const Gdk::GC>&)" and
"Glib::unwrap<const Gdk::GC>(const Glib::RefPtr<const Gdk::GC>&)".
"drawable.cc", line 283: Error: Overloading ambiguity between
"Glib::unwrap<Gdk::GC>(const Glib::RefPtr<const Gdk::GC>&)" and
"Glib::unwrap<const Gdk::GC>(const Glib::RefPtr<const Gdk::GC>&)".
"drawable.cc", line 288: Error: Overloading ambiguity between
"Glib::unwrap<Gdk::GC>(const Glib::RefPtr<const Gdk::GC>&)" and
"Glib::unwrap<const Gdk::GC>(const Glib::RefPtr<const Gdk::GC>&)".

These errors vanish by specializing the Glib::unwrap function call, e.g.

@@ -33,7 +33,7 @@
 {
   // Don't assume the reinterpret_cast<> works everywhere.  Gdk::Point is
*special*.
   gdk_draw_points(
-      gobj(), const_cast<GdkGC*>(Glib::unwrap(gc)),
+      gobj(), const_cast<GdkGC*>(Glib::unwrap<Gdk::GC>(gc)),
       reinterpret_cast<GdkPoint*>(const_cast<Point*>(points.data())),
       points.size());
 }

As I'm not sure that this is the right solution, I place it here instead of
sending a patch against the CVS.

Regards Michael
Comment 1 Murray Cumming 2002-06-20 07:53:23 UTC
That seems acceptable. If I haven't done this in every place
necessary, then please submit a real patch. Thanks.
Comment 2 Michael v. Szombathely 2002-06-21 14:28:27 UTC
It turns out that all of the cases were generated by _WRAP_METHODs in 
drawable.hg. How to handle this?
Comment 3 Murray Cumming 2002-06-21 19:47:11 UTC
In one of the tools/m4/convert_*.m4 files. If you can't fix it
yourself, then tell me what method has the problem now.
Comment 4 Murray Cumming 2002-06-28 14:40:59 UTC
Do you need more help?
Comment 5 Murray Cumming 2002-07-03 20:09:50 UTC
I might have fixed this, but I can't tell because I'm not using Sun's
compiler. Please reopen if it's still a problem.
Comment 6 Michael v. Szombathely 2002-07-30 19:27:50 UTC
> I might have fixed this, but I can't tell because I'm not using
> Sun's compiler. Please reopen if it's still a problem.

No, its not fixed. Two cases in glyphstring.cc where added, see the
complete error log from the current CVS below.

I still patch this cases away by specialzing Gtk::unwrap with the
non-const form of the ambiguous type. Because this code was generated
by the _WRAP_METHODs, I really would like to see this fixed by the
maintainers. I can send the whole working patch if required.

--
"glyphstring.cc", line 131: Error: Overloading ambiguity between
"Glib::unwrap<Pango::Font>(const Glib::RefPtr<const Pango::Font>&)"
and "Glib::unwrap<const Pango::Font>(const Glib::RefPtr<const
Pango::Font>&)".
"glyphstring.cc", line 136: Error: Overloading ambiguity between
"Glib::unwrap<Pango::Font>(const Glib::RefPtr<const Pango::Font>&)"
and "Glib::unwrap<const Pango::Font>(const Glib::RefPtr<const
Pango::Font>&)".
2 Error(s) detected.
"drawable.cc", line 98: Warning (Anachronism): Assigning
void(*)(void*,void*) to extern "C" void(*)(void*,void*).
"drawable.cc", line 204: Error: Overloading ambiguity between
"Glib::unwrap<Gdk::GC>(const Glib::RefPtr<const Gdk::GC>&)" and
"Glib::unwrap<const Gdk::GC>(const Glib::RefPtr<const Gdk::GC>&)".
"drawable.cc", line 209: Error: Overloading ambiguity between
"Glib::unwrap<Gdk::GC>(const Glib::RefPtr<const Gdk::GC>&)" and
"Glib::unwrap<const Gdk::GC>(const Glib::RefPtr<const Gdk::GC>&)".
"drawable.cc", line 214: Error: Overloading ambiguity between
"Glib::unwrap<Gdk::GC>(const Glib::RefPtr<const Gdk::GC>&)" and
"Glib::unwrap<const Gdk::GC>(const Glib::RefPtr<const Gdk::GC>&)".
"drawable.cc", line 219: Error: Overloading ambiguity between
"Glib::unwrap<Gdk::GC>(const Glib::RefPtr<const Gdk::GC>&)" and
"Glib::unwrap<const Gdk::GC>(const Glib::RefPtr<const Gdk::GC>&)".
"drawable.cc", line 224: Error: Overloading ambiguity between
"Glib::unwrap<Gdk::GC>(const Glib::RefPtr<const Gdk::GC>&)" and
"Glib::unwrap<const Gdk::GC>(const Glib::RefPtr<const Gdk::GC>&)".
"drawable.cc", line 224: Error: Overloading ambiguity between
"Glib::unwrap<Gdk::Drawable>(const Glib::RefPtr<const
Gdk::Drawable>&)" and "Glib::unwrap<const Gdk::Drawable>(const
Glib::RefPtr<const Gdk::Drawable>&)".
"drawable.cc", line 229: Error: Overloading ambiguity between
"Glib::unwrap<Gdk::GC>(const Glib::RefPtr<const Gdk::GC>&)" and
"Glib::unwrap<const Gdk::GC>(const Glib::RefPtr<const Gdk::GC>&)".
"drawable.cc", line 229: Error: Overloading ambiguity between
"Glib::unwrap<Gdk::Image>(const Glib::RefPtr<const Gdk::Image>&)" and
"Glib::unwrap<const Gdk::Image>(const Glib::RefPtr<const
Gdk::Image>&)".
"drawable.cc", line 234: Error: Overloading ambiguity between
"Glib::unwrap<Gdk::GC>(const Glib::RefPtr<const Gdk::GC>&)" and
"Glib::unwrap<const Gdk::GC>(const Glib::RefPtr<const Gdk::GC>&)".
"drawable.cc", line 239: Error: Overloading ambiguity between
"Glib::unwrap<Gdk::GC>(const Glib::RefPtr<const Gdk::GC>&)" and
"Glib::unwrap<const Gdk::GC>(const Glib::RefPtr<const Gdk::GC>&)".
"drawable.cc", line 239: Error: Overloading ambiguity between
"Glib::unwrap<Pango::Font>(const Glib::RefPtr<const Pango::Font>&)"
and "Glib::unwrap<const Pango::Font>(const Glib::RefPtr<const
Pango::Font>&)".
"drawable.cc", line 244: Error: Overloading ambiguity between
"Glib::unwrap<Gdk::GC>(const Glib::RefPtr<const Gdk::GC>&)" and
"Glib::unwrap<const Gdk::GC>(const Glib::RefPtr<const Gdk::GC>&)".
"drawable.cc", line 244: Error: Overloading ambiguity between
"Glib::unwrap<Pango::LayoutLine>(const Glib::RefPtr<const
Pango::LayoutLine>&)" and "Glib::unwrap<const Pango::LayoutLine>(const
Glib::RefPtr<const Pango::LayoutLine>&)".
"drawable.cc", line 249: Error: Overloading ambiguity between
"Glib::unwrap<Gdk::GC>(const Glib::RefPtr<const Gdk::GC>&)" and
"Glib::unwrap<const Gdk::GC>(const Glib::RefPtr<const Gdk::GC>&)".
"drawable.cc", line 249: Error: Overloading ambiguity between
"Glib::unwrap<Pango::LayoutLine>(const Glib::RefPtr<const
Pango::LayoutLine>&)" and "Glib::unwrap<const Pango::LayoutLine>(const
Glib::RefPtr<const Pango::LayoutLine>&)".
"drawable.cc", line 254: Error: Overloading ambiguity between
"Glib::unwrap<Gdk::GC>(const Glib::RefPtr<const Gdk::GC>&)" and
"Glib::unwrap<const Gdk::GC>(const Glib::RefPtr<const Gdk::GC>&)".
"drawable.cc", line 254: Error: Overloading ambiguity between
"Glib::unwrap<Pango::Layout>(const Glib::RefPtr<const
Pango::Layout>&)" and "Glib::unwrap<const Pango::Layout>(const
Glib::RefPtr<const Pango::Layout>&)".
"drawable.cc", line 259: Error: Overloading ambiguity between
"Glib::unwrap<Gdk::GC>(const Glib::RefPtr<const Gdk::GC>&)" and
"Glib::unwrap<const Gdk::GC>(const Glib::RefPtr<const Gdk::GC>&)".
"drawable.cc", line 259: Error: Overloading ambiguity between
"Glib::unwrap<Pango::Layout>(const Glib::RefPtr<const
Pango::Layout>&)" and "Glib::unwrap<const Pango::Layout>(const
Glib::RefPtr<const Pango::Layout>&)".
"drawable.cc", line 279: Error: Overloading ambiguity between
"Glib::unwrap<Gdk::GC>(const Glib::RefPtr<const Gdk::GC>&)" and
"Glib::unwrap<const Gdk::GC>(const Glib::RefPtr<const Gdk::GC>&)".
"drawable.cc", line 284: Error: Overloading ambiguity between
"Glib::unwrap<Gdk::GC>(const Glib::RefPtr<const Gdk::GC>&)" and
"Glib::unwrap<const Gdk::GC>(const Glib::RefPtr<const Gdk::GC>&)".
"drawable.cc", line 289: Error: Overloading ambiguity between
"Glib::unwrap<Gdk::GC>(const Glib::RefPtr<const Gdk::GC>&)" and
"Glib::unwrap<const Gdk::GC>(const Glib::RefPtr<const Gdk::GC>&)".
"drawable.cc", line 294: Error: Overloading ambiguity between
"Glib::unwrap<Gdk::GC>(const Glib::RefPtr<const Gdk::GC>&)" and
"Glib::unwrap<const Gdk::GC>(const Glib::RefPtr<const Gdk::GC>&)".
"drawable.cc", line 299: Error: Overloading ambiguity between
"Glib::unwrap<Gdk::GC>(const Glib::RefPtr<const Gdk::GC>&)" and
"Glib::unwrap<const Gdk::GC>(const Glib::RefPtr<const Gdk::GC>&)".
"drawable.cc", line 304: Error: Overloading ambiguity between
"Glib::unwrap<Gdk::GC>(const Glib::RefPtr<const Gdk::GC>&)" and
"Glib::unwrap<const Gdk::GC>(const Glib::RefPtr<const Gdk::GC>&)".
Compilation aborted, too many Error messages.

Comment 7 Murray Cumming 2002-07-30 20:02:06 UTC
As I have said before, _WRAP_METHOD uses the conversions defined the
tools/convert*.m4 files. Please look for the conversion in there and
try to patch one of those files.
Comment 8 Michael v. Szombathely 2002-07-30 22:15:35 UTC
Created attachment 10127 [details] [review]
patches to prevent ambiguity error with Sun's Forte C++ compiler
Comment 9 Michael v. Szombathely 2002-07-30 22:17:43 UTC
[I finally got it, thanks for your hints - still some comments]

I have placed the macros __CONVERT_CONST_REFPTR_TO_P and
__CONVERT_CONST_REFPTR_TO_P_SUN now in convert_base.m4 as they are
used in several files (convert_{gdk,gtk,pango}.m4). The special
handlings were added to convert_gdk.m4 and convert_pango.m4.

The special handling with __CONVERT_CONST_REFPTR_TO_P_SUN for the
types which were reclaimed by the Sun C++ compiler solves the problems
for the moment. But I would advise to correct
__CONVERT_CONST_REFPTR_TO_P in a more general way that it works for
both g++ and Sun's Forte C++ compiler.
Comment 10 Michael v. Szombathely 2002-07-30 22:20:22 UTC
*** Bug 89451 has been marked as a duplicate of this bug. ***
Comment 11 Murray Cumming 2002-07-31 09:38:10 UTC
Applied. Thanks.

I would accept a patch that used this explicit template specalization
for  the standard __CONVERT_CONST_REFPTR_TO_P() and similar macros.
You should keep the old definition there but comment it out, with your
explanation.