MathGroup Archive 2002

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Function resolution bug in g++ ?

  • To: mathgroup at
  • Subject: [mg35505] Re: Function resolution bug in g++ ?
  • From: Nathan Sidwell <nathan at>
  • Date: Wed, 17 Jul 2002 02:08:51 -0400 (EDT)
  • References: <>
  • Reply-to: nathan at
  • Sender: owner-wri-mathgroup at

Bill Huey wrote:
> Hello,
> This looks like a bug, so I'm posting my report here.
> I'm getting this nasty error:
>         /usr/home/billh/javasrc_1_3_scsl/hotspot1.3.1/src/share/vm/memory/markSweep.cpp: In
>            static member function `static void MarkSweep::mark_sweep_phase1(jint&, long
>            int)':
>         /usr/home/billh/javasrc_1_3_scsl/hotspot1.3.1/src/share/vm/memory/markSweep.cpp:573: call
>            of overloaded `TraceTime(char[8], bool)' is ambiguous
>         /usr/home/billh/javasrc_1_3_scsl/hotspot1.3.1/src/share/vm/runtime/timer.hpp:64: candidates
>            are: TraceTime::TraceTime(const char*, elapsedTimer*, long int = v_true,
>            long int = v_false)
>         /usr/home/billh/javasrc_1_3_scsl/hotspot1.3.1/src/share/vm/runtime/timer.hpp:63:
>                           TraceTime::TraceTime(const char*, long int = v_true)
>         /usr/home/billh/javasrc_1_3_scsl/hotspot1.3.1/src/share/vm/memory/markSweep.cpp: In
>            static member function `static void MarkSweep::mark_sweep_phase2()':
> from this code:
>         TraceTime tm("phase 2", (bool) PrintGC && Verbose);
you have
#defined bool long int
that '(bool) PrintGC && Verbose' is parsed as ((long int)PrintGC) && Verbose
and in your case is an integral constant expression of value zero. It
also has type bool (C++'s bool, not your #define).
That argument can undergo
	pointer conversion to a null pointer value of type elapsedTimer *
	integral promotion to int, followed by integral conversion to long
those conversions are unordered wrt eachother.
When I try it on what I think your doing,
	void Foo (char const *, int *);
	void Foo (char const *, long);

	int main ()
	  Foo ("hello", false);
	  return 0;
I get 
nathan@manao:557>/usr/local/egcs/sparc-SunOS-5/bin/g++ -c In function `int main()': call of overloaded `Foo(const char[6], bool)' is ambiguous candidates are: void Foo(const char*, int*)                 void Foo(const char*, long int)


Dr Nathan Sidwell :: Computer Science Department :: Bristol University
           The voices in my head told me to say this
nathan at  nathan at

  • Prev by Date: RE: Expanding expressions with Dot, Times and Plus
  • Next by Date: Re: How to select all polynomials which have degree greater than a give number out of a list of polynomials!
  • Previous by thread: RE: simplifying operator experessions with Dot, Times a nd Plus
  • Next by thread: export HDF files